Describe the bug
Running the repo's own pre-commit on a clean checkout of main fails immediately, before linting any file:
ruff.....................................................................Failed
- hook id: ruff
Cause: TOML parse error at line 5, column 1
|
5 | [tool.ruff.lint]
| ^^^^^^^^^^^^^^^^
Unknown rule selector: `UP045`
The cause is a version mismatch:
.pre-commit-config.yaml pins astral-sh/ruff-pre-commit at rev: v0.2.1.
pyproject.toml [tool.ruff.lint].ignore lists UP045 (and UP035), which are newer rule selectors that ruff 0.2.1 does not recognize.
setup.py separately pins extras["quality"] = ["ruff == 0.13.1"].
So make quality (ruff 0.13.1) works, but pre-commit run (ruff 0.2.1) is broken for anyone who follows the CONTRIBUTING setup and installs the hooks.
Reproduction
git clone https://github.com/huggingface/accelerate && cd accelerate
pip install pre-commit
pre-commit run --all-files # fails: Unknown rule selector: UP045
Expected behavior
pre-commit should use the same ruff the project targets, so the hooks pass on a clean checkout.
Suggested fix
Bump the pre-commit hook to match the quality extra:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.1
Happy to send a PR if useful.
Describe the bug
Running the repo's own
pre-commiton a clean checkout ofmainfails immediately, before linting any file:The cause is a version mismatch:
.pre-commit-config.yamlpinsastral-sh/ruff-pre-commitatrev: v0.2.1.pyproject.toml[tool.ruff.lint].ignorelistsUP045(andUP035), which are newer rule selectors that ruff 0.2.1 does not recognize.setup.pyseparately pinsextras["quality"] = ["ruff == 0.13.1"].So
make quality(ruff 0.13.1) works, butpre-commit run(ruff 0.2.1) is broken for anyone who follows the CONTRIBUTING setup and installs the hooks.Reproduction
Expected behavior
pre-commitshould use the same ruff the project targets, so the hooks pass on a clean checkout.Suggested fix
Bump the pre-commit hook to match the
qualityextra:Happy to send a PR if useful.