Skip to content

pin ruff and state the lint rules explicitly - #10

Merged
jbloom merged 1 commit into
mainfrom
pin-ruff-and-declare-lint-rules
Aug 20, 2026
Merged

pin ruff and state the lint rules explicitly#10
jbloom merged 1 commit into
mainfrom
pin-ruff-and-declare-lint-rules

Conversation

@jbloom

@jbloom jbloom commented Aug 20, 2026

Copy link
Copy Markdown
Member

Why

CI is red on main today, on code nobody touched.

ruff>=0.6 is unpinned in the dev extra, and ruff's default rule set widened in 0.16.
So CI, which installs the latest, now reports 22 findings across 12 files, while a local
.venv sitting on 0.15.12 reports none. That version skew is also why scripts/check.sh
passes locally and the same check fails in Actions.

Verified:

setup result
main + ruff 0.15.12 clean
main + ruff 0.16.4, inheriting default rules 22 errors
main + ruff 0.16.4 + explicit select clean

What this does

  • States the rules. [tool.ruff.lint] select = ["E4", "E7", "E9", "F"] — ruff's
    pre-0.16 defaults, i.e. exactly what this project has been checked against all along.
    The selection becomes a project decision instead of tracking whatever ruff ships.
  • Pins ruff to >=0.16,<0.17, so a contributor's local run and CI agree on the
    version, not just the rule set.

No source changes — main is clean under 0.16.4 once the selection is declared.

What this deliberately does not do

Adopt the wider 0.16 rule set. Those 22 findings are mostly legitimate (C408
dict()→literal ×7, SIM102 nested ifs ×4, UP035/UP037, PYI041, RUF022, PERF102, I001,
BLE001), but acting on them is churn across 12 files and a separate decision. Worth its
own change if you want it.

black>=24 is also unpinned and carries the same latent risk, though black's output has
been far more stable. Left alone here.

Note

This unblocks #9, which was reported red for these pre-existing findings and introduces
none of its own — main and that branch both report the identical 22 under 0.16.4.

🤖 Generated with Claude Code

CI has been red on unchanged code. `ruff>=0.6` is unpinned, and ruff's *default*
rule set widened in 0.16, so CI (which installed 0.16.4) reported 22 findings
across 12 files while a local `.venv` on 0.15.12 reported none.

Declare `[tool.ruff.lint] select` as ruff's pre-0.16 defaults -- the rules this
project has actually been checked against -- so the selection is a project
decision rather than whatever the installed ruff happens to default to, and pin
ruff to `>=0.16,<0.17` so local and CI agree on the version.

No source changes: main is clean under 0.16.4 once the selection is stated.
Adopting the wider rule set is a separate question, left for its own change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jbloom
jbloom merged commit 3216308 into main Aug 20, 2026
3 checks passed
@jbloom
jbloom deleted the pin-ruff-and-declare-lint-rules branch August 20, 2026 20:26
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