Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .PHONY: check check-fmt check-test check-clippy check-lines fmt clippy test help
  2. # Run all quality gates (delegates to the shared script for use in CI).
  3. check:
  4. @./scripts/check.sh
  5. # Individual gates (for iterating on a single failure).
  6. check-fmt:
  7. cargo fmt --check
  8. check-test:
  9. cargo test
  10. check-clippy:
  11. cargo clippy --all-targets -- -D warnings
  12. # Ensure no Rust source file exceeds 500 lines (see AGENTS.md).
  13. check-lines:
  14. @exit_code=0; \
  15. max=500; \
  16. for f in src/**/*.rs src/*.rs; do \
  17. [ -f "$$f" ] || continue; \
  18. lines=$$(wc -l < "$$f"); \
  19. if [ "$$lines" -gt "$$max" ]; then \
  20. echo "FAIL: $$f has $$lines lines (max $$max)"; \
  21. exit_code=1; \
  22. fi; \
  23. done; \
  24. if [ "$$exit_code" -eq 0 ]; then \
  25. echo "✅ All Rust source files are under $$max lines"; \
  26. else \
  27. exit "$$exit_code"; \
  28. fi
  29. # Auto-fix formatting (not a gate; use sparingly before committing).
  30. fmt:
  31. cargo fmt --all
  32. # Auto-fix lints (clippy --fix); review the diff before committing.
  33. clippy-fix:
  34. cargo clippy --all-targets --fix --allow-dirty --allow-staged
  35. help:
  36. @echo "make check Run all quality gates (fmt, test, clippy, lines)"
  37. @echo "make check-fmt Run cargo fmt --check"
  38. @echo "make check-test Run cargo test"
  39. @echo "make check-clippy Run cargo clippy --all-targets -- -D warnings"
  40. @echo "make check-lines Verify all src/**/*.rs are ≤500 lines"
  41. @echo "make fmt Auto-fix formatting"
  42. @echo "make clippy-fix Apply clippy suggestions (review diff)"