ci: add pre-commit hooks mirroring make quality - #863
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Require one maintainer reviewAll PRs must have at least one approving review from a maintainer before merging.
|
Add a .pre-commit-config.yaml whose hooks mirror the checks run by `make quality` (copyright headers, black, isort, flake8, and tools/lint_cuda.py), each scoped to the same paths that target uses (PYCHECKDIRS / PYCHECKGLOBS), plus a DCO sign-off commit-msg hook. This catches issues locally before CI runs them. The formatters/linters run as local system hooks so they use the exact versions pinned in the [dev] extra and the config in setup.cfg. Pin pre-commit in [dev] and document usage in the README. Signed-off-by: Orestis Zambounis <23146389+orestis-z@users.noreply.github.com>
e17425a to
e39f924
Compare
brian-dellabetta
left a comment
There was a problem hiding this comment.
Thanks @orestis-z ! Can we land this to try it out before landing the llm-compressor one?
Adds pre-commit hooks that mirror the checks in
make quality, so contributors catch issues locally before CI runs them. Modeled on vllm-project/speculators#1044, adapted to this repo's tooling.What runs
The hooks mirror
make quality, each scoped to the same paths that target uses:--target-version py310), isort, flake8 — scoped toPYCHECKDIRS(src tests).utils/copyright.py quality, scoped toPYCHECKGLOBS(src tests utils examples setup.py).tools/lint_cuda.py --fail-on-issues, scoped tosrc tests.commit-msghook that appends a DCOSigned-off-bytrailer if missing, matching thegit commit -srequirement.The formatters/linters run as local
systemhooks (rather than pinned remote mirrors) so they use the exact versions from the[dev]extra and the config insetup.cfg. This also sidesteps a build failure when installing the oldisort==5.8.0pre-commit mirror. Scoping withfiles:matters here — e.g.setup.pyis intentionally excluded from black/isort/flake8 inmake quality, so it stays excluded.Also
pre-commit>=4.0.0to the[dev]extra.CONTRIBUTING.md).Usage
🤖 Generated with Claude Code