Implement pre-commit hooks for automated code quality and testing checks.
This challenge is tech-agnostic. Choose your preferred programming language, framework, database, ORM, hook management tool, and CI/CD. For middle level, you can use advanced features.
- Set up pre-commit hooks
- Automate code checks before commits
- Prevent low-quality code commits
-
Environment Setup:
- Programming language and web framework
- Database and ORM
- Pre-commit hook tool
- Linting and testing tools
- Docker (recommended for containerization)
-
Implementation Details:
- Configure pre-commit hooks
- Add checks for linting, formatting, and tests
- Handle hook failures gracefully
-
Testing:
- Attempt commits and verify hook execution
- Add custom hooks
- Implement selective hook running
By completing this challenge, you will understand commit quality control.
Happy coding!