Skip to content

chore(ruff): pin ruff hook and dependency to 0.14.8 - #5

Merged
Jamie-BitFlight merged 1 commit into
mainfrom
chore/ruff-lock-parity
Aug 31, 2026
Merged

Jamie-BitFlight merged 1 commit into
mainfrom
chore/ruff-lock-parity

Conversation

@Jamie-BitFlight

@Jamie-BitFlight Jamie-BitFlight commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Problem

.pre-commit-config.yaml pinned ruff-pre-commit at v0.16.5 while uv.lock resolved ruff 0.14.8. The hook and CI therefore ran different ruff versions over the same files.

Measured on a clean checkout of origin/main:

$ uv run ruff --version
ruff 0.14.8
$ uv run prek run --all-files
Lint Python with ruff....................................................Failed
  Found 16 errors (13 fixed, 3 remaining).

The 0.16.5 hook deletes the justified # noqa: PLC0415 suppressions in packages/ensure_uv/version.py — rewriting one into the 0.16-only # ruff: ignore[import-outside-top-level] spelling that 0.14.8 does not understand — and then reports the PLC0415 violations it just unsuppressed.

Direction: pin the hook down, not the dependency up

Bumping the dependency to 0.16.5 was tried first and does not fix it: with both sides on 0.16.5 the hook still deletes its own suppressions under unsafe-fixes = true and the gate stays red with the same 16 errors. Pinning the hook down to the locked 0.14.8 is the direction that leaves the repo green, matching the mkapidocs precedent.

ruff>=0.14.8 → ruff==0.14.8

So the locked version cannot float away from the hook rev on the next uv lock --upgrade.

mxr/sync-pre-commit-deps cannot police this. It is configured in this repo, but its source hardcodes:

SUPPORTED = frozenset(('black', 'flake8', 'mypy'))

and it only rewrites additional_dependencies entries inside .pre-commit-config.yaml. It never reads pyproject.toml or uv.lock, and it does not handle ruff at all. Measured directly: with ruff==0.15.3 pinned and the hook left at v0.16.5 in a sibling repo, the hook reports Passed and rewrites nothing. Keeping hook and lock in step is manual.

Verification

$ uv run prek run --all-files    # all hooks pass, working tree clean afterwards
$ uv run ruff check --no-fix --output-format=github packages/   # exit 0

🤖 Generated with Claude Code

https://claude.ai/code/session_01QJeBLNA9ybmQvv5REMDkrc

@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a85ef0f-291e-43f1-81c6-deb32463baf8


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-31T08:12:40.015985Z 30dd6bf New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

`.pre-commit-config.yaml` pinned `ruff-pre-commit` at v0.16.5 while
`uv.lock` resolved ruff 0.14.8, so the hook and CI ran different ruff
versions against the same files.

Measured: with the 0.16.5 hook and the 0.14.8 lock, `prek run --all-files`
deletes the justified `# noqa: PLC0415` suppressions in
`packages/ensure_uv/version.py` (rewriting one into the 0.16-only
`# ruff: ignore[import-outside-top-level]` spelling) and then reports the
PLC0415 violations it just unsuppressed.

Bumping the dependency up to 0.16.5 does not fix it: 0.16.5 deletes its
own suppressions under `unsafe-fixes = true` and the gate stays red with
the same 16 errors. So the hook is pinned down to the locked version
instead, matching the mkapidocs precedent.

`ruff` also moves from `>=0.14.8` to `==0.14.8` so the locked version
cannot float away from the hook rev on the next `uv lock --upgrade`.
Note that the `mxr/sync-pre-commit-deps` hook configured here cannot
police this: its source hardcodes `SUPPORTED = frozenset(('black',
'flake8', 'mypy'))` and it only rewrites `additional_dependencies`
entries inside `.pre-commit-config.yaml` — it never reads `pyproject.toml`
or `uv.lock`. Keeping the two in step remains manual.

Verified: `uv run prek run --all-files` passes with a clean tree.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QJeBLNA9ybmQvv5REMDkrc
@Jamie-BitFlight
Jamie-BitFlight merged commit 47cd37b into main Aug 31, 2026
18 checks passed
@Jamie-BitFlight
Jamie-BitFlight deleted the chore/ruff-lock-parity branch August 31, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant