Skip to content

Add pre-commit lint hooks: cast, private functions, partial assertions#2555

Merged
hiroshinishio merged 1 commit intomainfrom
wes
Apr 19, 2026
Merged

Add pre-commit lint hooks: cast, private functions, partial assertions#2555
hiroshinishio merged 1 commit intomainfrom
wes

Conversation

@hiroshinishio
Copy link
Copy Markdown
Collaborator

@hiroshinishio hiroshinishio commented Apr 19, 2026

Summary

  • Added 3 new pre-commit lint hooks enforcing coding standards automatically:
    • check_cast_usage.sh: Blocks cast() in implementation files (allowed in test fixtures)
    • check_private_functions.sh: Blocks _-prefixed function definitions in impl files (inline or own file)
    • check_partial_assertions.sh: Blocks assert X in Y in test files (use assert X == Y)
  • Updated check_test_files.sh to skip comment-only diffs (no test change required for adding/removing comments)
  • Excluded test files from ruff T201 print check (print in tests is fine)
  • Updated CLAUDE.md testing guidance: running impl to get output is OK, but must manually verify correctness
  • Skipped integration tests by default via pytest.ini -m "not integration" to cut 236s from pre-commit

Social Media Post (GitAuto)

Add pre-commit hooks enforcing code quality rules

  • New hooks block cast() in impl files, private functions, and partial test assertions
  • Integration tests now skipped by default, cutting pre-commit time by over 3 minutes
  • Comment-only diffs no longer require test file changes

Social Media Post (Wes)

Three rules I kept repeating in code reviews: no cast in production code, no private functions, no partial assertions. Wrote shell scripts to enforce all three at commit time. Now I review logic instead of style.

@hiroshinishio hiroshinishio self-assigned this Apr 19, 2026
@hiroshinishio hiroshinishio merged commit 04a0eb2 into main Apr 19, 2026
1 check passed
@hiroshinishio hiroshinishio deleted the wes branch April 19, 2026 07:08
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.

1 participant