All 5 git hooks now installed and active via lefthook:
✓ pre-commit
✓ commit-msg
✓ pre-push
✓ post-checkout
✓ post-merge
Purpose: Quality gates to ensure code meets standards before commit
Runs in parallel:
- go mod tidy validation
- go vet static analysis
- gofmt formatting check
- golangci-lint comprehensive linting
- golangci-lint extra quality linters
- gosec security scanning
- Secret detection (checks code files only)
When it runs: Every commit Can skip: No (quality enforcement)
Purpose: Enforce commit message standards
Validates:
- Minimum 10 character length
- Conventional commits format (recommends, doesn't enforce)
- Format: type(scope): message
- Types: feat, fix, docs, style, refactor, test, chore, perf, ci, build, revert
- Blocks WIP commits to main/master branches
- Allows merge commits
Examples: ✓ "feat(core): add new scheduler algorithm" ✓ "fix(web): resolve authentication timeout issue" ✗ "test" (too short) ✗ "WIP commit" (on main branch)
When it runs: Every commit (after pre-commit) Can skip: No (message quality)
Purpose: Final safety check before code reaches remote
Checks:
- Full test suite with race detection (go test -race -timeout=5m ./...)
- Protected branch warnings (main/master/production)
- Interactive prompt: requires "yes" to proceed
- Quick lint check on changed files
When it runs: Every git push Can skip: Yes (ctrl+c on protected branch prompt)
Purpose: Developer reminders after switching branches
Checks:
- Dependency changes (go.mod/go.sum)
- Reminds to run: go mod download
- Hook installation status
- Reminds to run: make setup (if hooks not installed)
When it runs: After git checkout Can skip: N/A (informational only)
Purpose: Auto-update dependencies after merging
Actions:
- Detects go.mod/go.sum changes in merge
- Automatically runs: go mod download
- Suggests running tests after update
When it runs: After git merge Can skip: N/A (automatic, helpful)
| Hook | Typical Time | Max Time | Skippable |
|---|---|---|---|
| pre-commit | 4-6s | 10s | No |
| commit-msg | <0.1s | <0.1s | No |
| pre-push | 10-30s | 60s+ | Yes* |
| post-checkout | <0.1s | <0.1s | Info only |
| post-merge | 0-5s | 10s | Auto |
*Protected branch prompt only
- Quality Enforcement: All commits meet code standards
- Message Standards: Consistent commit history for changelogs
- Test Safety: Broken code never reaches remote
- Protected Branches: Prevents accidental pushes to main
- Dependency Management: Auto-updates after merges
- Developer Experience: Fast parallel execution
| Aspect | Before (Husky) | After (lefthook) |
|---|---|---|
| Hooks | pre-commit only | All 5 hooks |
| Speed | ~6-9s | ~4-6s |
| Dependencies | Node.js | None (Go) |
| Test Suite | Manual | Automatic (pre-push) |
| Message Validation | None | Conventional commits |
| Protected Branches | None | Warning system |
| Dependency Updates | Manual | Automatic |