Git pre-commit hooks are configured for linting
Why it matters
Pre-commit hooks catch linting and formatting violations at commit time — seconds after the code is written — rather than in CI (minutes later) or code review (hours or days later). Without hooks, malformatted code enters the repository freely, and style violations accumulate until code review becomes dominated by formatting comments instead of logic review. ISO 25010 maintainability.modifiability degrades as the codebase becomes harder to read. SSDF PW.7 recognizes automated code review tooling as a software assurance control.
Severity rationale
Low because absent git hooks allow preventable style and lint violations to enter the codebase, increasing review burden, but CI and code review provide a slower fallback.
Remediation
Set up Husky and lint-staged to enforce linting on every commit:
npm install -D husky lint-staged
npx husky init
echo "npx lint-staged" > .husky/pre-commit
Add to package.json:
"lint-staged": {
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
"*.{json,md,css}": ["prettier --write"]
}
After setup, every git commit lints and formats staged files automatically. Commits that fail linting are blocked until the issues are resolved. If CI already runs npm run lint on every PR, this check can be skipped — see the skip criteria.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Code Maintainability Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · maintainability.modifiability — Modifiability
- ssdf:800-218 · PW.7 — Review and/or Analyze Human-Readable Code
Taxons
History
- 2026-04-18·v1.0.0·Initial import from code-maintainability·automated