Skip to content

[plan] Add check-validator-sizes Makefile target to enforce 300-line limit #21481

Description

@github-actions

Objective

Add a check-validator-sizes Makefile target that enforces the 300-line hard limit for validator files documented in AGENTS.md, and integrate it into the CI/lint chain.

Context

From discussion #21398 (Repository Quality Improvement Report - Validator File Size Compliance). The 300-line hard limit is documented in AGENTS.md but has no automated enforcement. A lightweight check in the Makefile would prevent future regressions after the current violations (Tasks 1–3) are fixed.

Approach

Add the following target to the Makefile:

## check-validator-sizes: Verify validator files do not exceed 300 lines (AGENTS.md hard limit)
check-validator-sizes:
	`@echo` "Checking validator file sizes..."
	`@violations`=$$(find ./pkg -type f -name "*valid*.go" ! -name "*_test.go" -exec wc -l {} \; | awk '$$1 > 300 {print $$1, $$2}' | sort -rn); \
	if [ -n "$$violations" ]; then \
		echo "❌ Validator files exceeding 300-line limit (AGENTS.md §Validation Complexity Guidelines):"; \
		echo "$$violations"; \
		exit 1; \
	else \
		echo "✅ All validator files within 300-line limit"; \
	fi

Then add check-validator-sizes to the lint target's dependencies (or to agent-finish) so it runs automatically.

Important: This task should be completed after the split tasks (Split expression_validation.go, Split strict_mode_validation.go, Split permissions_validation.go) have merged, so the check passes on the first run in CI.

Files to Modify

  • Update: Makefile — add check-validator-sizes target and wire it into lint or agent-finish

Acceptance Criteria

  • make check-validator-sizes target exists and works
  • The target prints filename and line count for each violation
  • The target exits with non-zero status when violations are found
  • The target is included in make lint or make agent-finish
  • A comment in the Makefile references the AGENTS.md guideline
  • The CI passes (all current violations from the split tasks should be resolved first)

Generated by Plan Command for issue #discussion #21398 · ◷

  • expires on Mar 19, 2026, 11:46 PM UTC

Activity

  1. github-actions commented on Mar 20, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-03-19T23:46:09.836Z.

    Closed by Workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions