| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- .PHONY: check check-fmt check-test check-clippy check-lines fmt clippy test help
- # Run all quality gates (delegates to the shared script for use in CI).
- check:
- @./scripts/check.sh
- # Individual gates (for iterating on a single failure).
- check-fmt:
- cargo fmt --check
- check-test:
- cargo test
- check-clippy:
- cargo clippy --all-targets -- -D warnings
- # Ensure no Rust source file exceeds 500 lines (see AGENTS.md).
- check-lines:
- @exit_code=0; \
- max=500; \
- for f in src/**/*.rs src/*.rs; do \
- [ -f "$$f" ] || continue; \
- lines=$$(wc -l < "$$f"); \
- if [ "$$lines" -gt "$$max" ]; then \
- echo "FAIL: $$f has $$lines lines (max $$max)"; \
- exit_code=1; \
- fi; \
- done; \
- if [ "$$exit_code" -eq 0 ]; then \
- echo "✅ All Rust source files are under $$max lines"; \
- else \
- exit "$$exit_code"; \
- fi
- # Auto-fix formatting (not a gate; use sparingly before committing).
- fmt:
- cargo fmt --all
- # Auto-fix lints (clippy --fix); review the diff before committing.
- clippy-fix:
- cargo clippy --all-targets --fix --allow-dirty --allow-staged
- help:
- @echo "make check Run all quality gates (fmt, test, clippy, lines)"
- @echo "make check-fmt Run cargo fmt --check"
- @echo "make check-test Run cargo test"
- @echo "make check-clippy Run cargo clippy --all-targets -- -D warnings"
- @echo "make check-lines Verify all src/**/*.rs are ≤500 lines"
- @echo "make fmt Auto-fix formatting"
- @echo "make clippy-fix Apply clippy suggestions (review diff)"
|