Skip to content

fix(rules): enforce lists.min_items during validation - #101

Merged
jackchuka merged 1 commit into
mainfrom
fix/list-min-items
Nov 11, 2026
Merged

jackchuka merged 1 commit into
mainfrom
fix/list-min-items

Conversation

@jackchuka

Copy link
Copy Markdown
Owner

Summary

min_items was documented in the README and schema.json, but only template generation read it; validation never checked it. The parser now records each list's top-level item count, and the list rule reports every list matching the rule's type that has fewer items than min_items.

Fixes #90

✗ 3:3 [list] List in section 'Doc' requires at least 5 items, found 1

Changes

  • parser.List gains ItemCount (direct items only; nested sub-list items are not counted)
  • internal/rules/list.go: per-list min_items check, reported at the list's own line/column; type filter extracted into listMatchesType
  • Tests: too few items, nested items not counted, type respected

Behavior change

Schemas that set min_items will now report lists that are too short. Worth a note in the release.

Test plan

min_items was documented and used for template generation, but the
list rule never checked it. Record each list's top-level item count in
the parser and report every list matching the rule's type that has
fewer items than min_items, at the list's own position.

Fixes #90

Claude-Session: https://claude.ai/code/session_014K1p9VkeotiX1SR8pLWJSK
@jackchuka
jackchuka marked this pull request as ready for review November 11, 2026 04:44
@jackchuka
jackchuka merged commit cfce26d into main Nov 11, 2026
1 check passed
@jackchuka
jackchuka deleted the fix/list-min-items branch November 11, 2026 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lists.min_items is not enforced during validation

1 participant