Pin the lint contract: explicit rule set, bounded ruff - #1
Open
keithadler wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI started failing on code that had not changed.
Cause
ruff 0.16widened its default rule selection to include isort, pylint, flake8-simplify, flake8-blind-except and RUF rules.[tool.ruff]here only setline-lengthandtarget-version— it never declared aselect, so it silently inherited the new, wider default.ruff>=0.4was 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
select = ["E4", "E7", "E9", "F"]— the set this code was written againstruff>=0.4,<0.17so the lint contract can't drift again silentlyDeliberately not fixed by rewriting flagged code: the blind
except Exceptionaroundeval()andpslq()is intentional — a linter must degrade toNone, 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 passedruff check .→ All checks passed!exact src/ --format github→ exit 0🤖 Generated with Claude Code