Skip to content

tooling: pin the ruff rule selection and move CI to 0.16.1 - #40

Merged
dcj merged 1 commit into
mainfrom
fix/ruff-pin-0-16
Aug 7, 2026
Merged

tooling: pin the ruff rule selection and move CI to 0.16.1#40
dcj merged 1 commit into
mainfrom
fix/ruff-pin-0-16

Conversation

@dcj

@dcj dcj commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Closes #39. Also adds .DS_Store to .gitignore.

What the investigation actually found

The issue as filed assumed the 0.15.21 -> 0.16.x delta was limited to Markdown formatting. It is not. Ruff 0.16 also widened its default lint selection, so on an unchanged codebase:

ruff check . ruff format --check .
0.15.21 (old pin) clean clean
0.16.1 381 errors 5 files would be reformatted

The 381 are real source, not Markdown: 194 UP045 (Optional[X] -> X | None), 44 UP006 (typing.List -> list), 38 LOG015, 17 BLE001, and a long tail. The repo declared only ignore, never select, so it silently inherited whatever the installed ruff considered default.

The fix

Declare the selection explicitly so it stops depending on ruff's defaults:

[tool.ruff]
line-length = 120
extend-exclude = ["*.md"]

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F"]
ignore = ["E402", "E721"]

That is exactly ruff's historical default set, so this preserves current behaviour rather than changing it. Verified clean on both versions with zero source changes:

ruff@0.16.1  check -> All checks passed!   format --check -> 31 files already formatted
ruff@0.15.21 check -> All checks passed!   format --check -> 31 files already formatted

548 passed.

Deliberately not done

Adopting the 381 violations. That is a real codebase modernization touching type annotations throughout, with requires-python >= 3.10 implications, and it deserves its own reviewable diff rather than riding in on a pin bump. Widening select is now an explicit act.

Ruff 0.16 widened its default lint selection (UP, LOG, BLE, I, RUF and more) and
began formatting Python code blocks embedded in Markdown. The result was that an
unchanged codebase reported 0 or 381 violations depending only on which ruff you
ran, and four docs files showed phantom format diffs locally that CI never saw.

Declare select = ["E4", "E7", "E9", "F"] explicitly so the project's rule set no
longer depends on ruff's shifting defaults, exclude Markdown from check and
format, and bump the CI pin. Verified clean on BOTH 0.16.1 and 0.15.21 with no
source changes, so widening the rule set stays a deliberate act rather than an
upgrade side-effect.

Also adds .DS_Store to .gitignore; it was absent, which is why stray copies sat
untracked in the working tree.

Closes #39.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dcj
dcj merged commit abb53be into main Aug 7, 2026
5 checks passed
@dcj
dcj deleted the fix/ruff-pin-0-16 branch August 7, 2026 14:30
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.

Decide the ruff pin bump before 0.16.x bites

1 participant