feat: add pre-commit hooks for local development
What does this MR do and why?
Implements local git hooks using pre-commit to catch code quality issues before commits. This ensures developers follow the same linting and formatting standards enforced in the CI pipeline locally, providing immediate feedback and reducing failed CI builds.
References
- Related to: DX improvements for local development
Screenshots or screen recordings
N/A - Infrastructure/tooling change
How to set up and validate locally
-
Pull the feature branch:
git checkout feature/local-pre-commit-hooks -
Install dependencies:
uv sync --all-extras -
Install pre-commit hooks:
pre-commit install -
Test the hooks by modifying a file and committing:
# Make a test change git add . git commit -m "test: verify pre-commit hooks work" # Hooks will run automatically and may fix formatting -
Verify hooks run on every commit:
pre-commit run --all-files # Run on all files
Changes Made
-
.pre-commit-config.yaml(new)- Ruff linting with auto-fix enabled
- Ruff formatting validation
- General file quality checks (trailing whitespace, YAML syntax, merge conflicts, private keys)
-
CONTRIBUTING.md(updated)- Added "Local Development Setup" section
- Documented pre-commit hook installation and usage
- Updated tool references from flake8/black to ruff
MR acceptance checklist
-
Code follows project style guidelines -
Tests pass locally: uv run pytest tests/ -
Pre-commit hooks pass: pre-commit run --all-files -
Documentation updated for developers -
No breaking changes -
Aligns with CI pipeline ( .gitlab-ci.yml)
This MR template includes:
- ✅ Clear description of the feature
- ✅ Setup and validation instructions
- ✅ List of changed files
- ✅ Complete acceptance checklist