You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace custom Git hooks implementation with Lefthook, following the
pattern used in React on Rails and Shakapacker projects.
Key improvements:
- Uses industry-standard Lefthook tool for hook management
- Parallel execution of pre-commit hooks for faster feedback
- Smart file detection using Lefthook's {staged_files} feature
- Pre-push hooks run full test suite before remote push
- Modular helper scripts in bin/lefthook/ directory
- Automatic hook installation via bin/setup
Hook configuration:
- Pre-commit (parallel, staged files only):
* RuboCop: Lints staged Ruby files
* RSpec: Runs tests for affected files
* Trailing newlines: Ensures proper file endings
- Pre-push (comprehensive):
* Full RuboCop on entire codebase
* Full RSpec test suite
Performance:
- Pre-commit: <5 seconds (staged files only, parallel execution)
- Pre-push: Full validation before sharing changes
- CI: Complete verification on all platforms
Benefits over custom solution:
- Maintained by community (Evil Martians)
- Built-in parallel execution
- Better file filtering with globs
- Easy to extend with new hooks
- Consistent with React on Rails/Shakapacker ecosystem
- Automatic re-staging of auto-fixed files (future enhancement)
Migration notes:
- Removed bin/setup-git-hooks (replaced by lefthook install)
- Added lefthook gem to Gemfile
- Created modular helper scripts for maintainability
- Updated README with comprehensive hook documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
0 commit comments