Skip to content

Pin the lint contract: explicit rule set, bounded ruff - #1

Open
keithadler wants to merge 1 commit into
mainfrom
fix/pin-ruff-ruleset
Open

Pin the lint contract: explicit rule set, bounded ruff#1
keithadler wants to merge 1 commit into
mainfrom
fix/pin-ruff-ruleset

Conversation

@keithadler

Copy link
Copy Markdown
Owner

CI started failing on code that had not changed.

Cause

ruff 0.16 widened its default rule selection to include isort, pylint, flake8-simplify, flake8-blind-except and RUF rules. [tool.ruff] here only set line-length and target-version — it never declared a select, so it silently inherited the new, wider default. ruff>=0.4 was unbounded, so CI picked up 0.16.3 and reported 13 errors.

Verified: under the classic rule set (E4, E7, E9, F) ruff 0.16.3 reports All checks passed! on the unmodified tree. The code was never wrong.

Fix

  • Declare select = ["E4", "E7", "E9", "F"] — the set this code was written against
  • Bound ruff>=0.4,<0.17 so the lint contract can't drift again silently

Deliberately not fixed by rewriting flagged code: the blind except Exception around eval() and pslq() is intentional — a linter must degrade to None, never crash on arbitrary user input. Auto-fixing those would have been a behavior regression.

Verification

All three CI steps run locally on Python 3.13 with ruff 0.16.3 (the version that broke it):

  • pytest -q → 250 passed
  • ruff check . → All checks passed!
  • exact src/ --format github → exit 0

🤖 Generated with Claude Code

CI began failing on unchanged code. ruff 0.16 widened its *default* rule
selection (isort, pylint, flake8-simplify, flake8-blind-except, RUF), and
this project had never declared a selection, so it silently inherited the
new one. 13 errors appeared in code that had not been touched since it
last passed.

Declare select = ["E4", "E7", "E9", "F"] - the set this code was actually
written against, under which it is clean - and bound ruff to <0.17 so the
lint contract cannot change again without a deliberate bump.

Not fixed by rewriting the flagged code: the blind `except Exception`
around eval() and pslq() is deliberate, since a linter must degrade to
None rather than crash on arbitrary user input.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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