Setup Ruff + pre-commit for linting and formatting
What does this MR do and why?
This Merge Request adds Ruff linting and pre-commit hooks to improve code quality, maintain consistent formatting, and enhance developer experience.
Changes Made
- Added Ruff linting and formatting using pre-commit hooks
- Updated
.pre-commit-config.yamlto use Ruff v0.11.5 - Enabled automatic fixes and exit-on-fix behavior
- Configured
pyproject.tomlto detect unused imports by removing F401 from ignore rules - Auto-formatted 54 files using Ruff
- Fixed 1 unused import detected by Ruff
- Added code quality setup instructions to
README.md
Why this change is needed
This improves the developer workflow by:
- Automatically formatting code before commits
- Preventing unused imports and lint errors
- Maintaining consistent code style across the project
- Improving overall code quality and maintainability
- Enhancing Developer Experience (DX)
References
Ruff Documentation: https://docs.astral.sh/ruff/\ Pre-commit Documentation: https://pre-commit.com/
How to set up and validate locally
-
Checkout this branch:
git checkout roughcheck -
Install dependencies:
pip install pre-commit ruff -
Install pre-commit hooks:
pre-commit install -
Run pre-commit on all files:
pre-commit run --all-files -
Make a test commit to verify Ruff runs automatically:
git add . git commit -m "Test pre-commit Ruff"
Ruff should automatically format files and fix lint issues before the commit is completed.
-
-
Ruff linting configured -
Code builds and runs locally -
Pre-commit hooks installed and working -
Documentation updated in README -
No breaking changes introduced -
Code formatted using Ruff -
Unused imports removed
-