Using pre-commit to stop the boring mistakes
Code review keeps repeating the same notes: trailing whitespace, YAML indentation, a committed .env, syntax errors. A tool should catch these, not a person.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks: [trailing-whitespace, end-of-file-fixer, check-yaml, check-merge-conflict]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.0
hooks: [gitleaks]
pre-commit install runs them on every commit. Secret scanning is the one that pays for itself — a token in git history is far more expensive to remove than to block.
Hooks are local, so agree on them as a team; the people using --no-verify will not be covered.