google-deepmind / google-deepmind/gemma
Add Pre-commit Hooks Configuration
- Dominant language
- Python
- Stars
- 5.7k
- Forks
- 1k
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 2
Description
Hello Gemma Team and Contributors,
I was analyzing the repository and noticed an opportunity to enhance the developer experience by adding a pre-commit configuration. This is a standard practice in many large OSS projects that helps automate code quality checks, catch issues before they are committed, and reduce CI/CD failures.
If this proposal is welcome, **I am happy to create a Pull Request** to implement it.
### Description
While the project already uses tools like `pyink` and `pylint`, they are not automatically enforced before a commit is made. Adding pre-commit hooks would integrate these checks (and other common ones) directly into the `git commit` workflow, providing immediate feedback to contributors.
### Proposed Implementation
1. **Create `.pre-commit-config.yaml`:**
* Add hooks for `pyink` (already used) and `pylint` (already configured).
* Include standard hooks for:
* YAML validation
* Trailing whitespace removal
* End-of-file fixer
* Large file prevention (check-large-files)
2. **Update `CONTRIBUTING.md`:**
* Add a small section instructing new contributors to install the hooks via `pip install pre-commit` and `pre-commit install`.
### Benefits
* **Improved Code Quality:** Prevents commits with formatting, linting, or simple file issues.
* **Reduced CI/CD Failures:** Catches these issues locally *before* they are pushed, saving CI resources and developer time.
* **Better Contributor Experience:** Provides immediate, local feedback to contributors about code style and standards.
Please let me know if the team is interested in this contribution. I'm ready to get started on the PR.
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.