ci: pin ruff's rule set so lint stops drifting - #271
Merged
Conversation
CI runs `pip install --quiet ruff` unpinned, and the repo had no ruff config, so lint enforced whatever ruff's defaults happened to be on the day it ran. Ruff has since widened those defaults, and `ruff check agent/` now reports 224 errors against unmodified main -- bandit S110, pylint PLW1510, BLE001 and friends -- turning every PR red without a line of our code changing. Pin the selection explicitly to what CI actually enforced until now: pyflakes plus the pycodestyle error classes. Real breakage is still caught -- F821 undefined names, F401 unused imports, E722 bare except. No source files change; `ruff check agent/` passes clean on 0.16.4.
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.
lintis currently red on every PR againstbux, including ones that touch no Python at all (e.g. #270, a one-line dependency bump). Nothing in our code broke.Cause.
.github/workflows/ci.ymlrunspip install --quiet ruffunpinned, and the repo has no ruff config. So lint enforced whatever ruff's default rule selection happened to be on the day CI ran. Ruff has since widened those defaults, andruff check agent/now reports 224 errors against unmodifiedmain(345ecbd) — I verified this in a clean worktree ofmain, same count, so it is not PR-specific.The 224 break down as rules that were never in the old default set:
Zero E/F errors — the code is clean under what CI was actually enforcing.
Fix. Add a root
ruff.tomlselecting the rule set explicitly (E4,E7,E9,F) instead of inheriting a moving default. This is version-independent: a future ruff release can widen its defaults all it likes and our lint stays put.I deliberately did not fix the 224. Most are
BLE001/S110in agent code where swallowing exceptions is the intended behaviour, and a 224-error sweep does not belong in a CI-repair PR. Opting into any of those rule families is a real decision — worth its own PR where the fixes get reviewed on their merits.This does not weaken lint. Verified against ruff 0.16.4:
ruff check agent/→All checks passed!(exit 0)import osunused and a reference to an undefined name still fails with F401 + F821.Follow-up:
ci.ymlshould pin the ruff version too, so behaviour changes within the selected rules can't surprise us. I had that change written but the push was rejected — the token lacksworkflowscope. Left as a follow-up and noted in a comment inruff.toml.Once this lands, #270 goes green on rebase.
Summary by cubic
Pins
ruff’s lint rule set via a new rootruff.tomlto stop CI drift and restore deterministic linting. Before: CI installed unpinnedruffand enforced changing defaults, producing 224 new failures on unchanged code; now: explicitselect = ["E4", "E7", "E9", "F"]preserves the previously enforced checks.Notes
ruff.tomlonly; no source changes.ruff check agent/passes onruff0.16.4.ruffversion in.github/workflows/ci.ymlonce a token withworkflowscope is available.Written for commit 15be26a. Summary will update on new commits.