maintenance: select ruff rules explicitly so CI is deterministic - #892
Merged
adbar merged 1 commit intoJul 28, 2026
Merged
Conversation
ruff 0.16.0 widened its default rule selection from 59 rules to 413. The dev extra requests an unpinned `ruff >= 0.15`, so `ruff check .` started reporting 103 errors on unmodified code and every open pull request went red. Verified on 3d89493 with no other changes: ruff 0.15.4 -> All checks passed! ruff 0.16.0 -> Found 103 errors. Selecting E4/E7/E9/F, ruff's pre-0.16 defaults, restores the previous behaviour and makes it immune to the next default change. This mirrors the reasoning already recorded for mypy in the same file: explicit options are stable across tool upgrades. `ruff format --check` was unaffected and still passes. Adopting parts of the new rule set is a separate decision and can be done rule by rule from here.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #892 +/- ##
=======================================
Coverage 99.68% 99.68%
=======================================
Files 21 21
Lines 4099 4099
=======================================
Hits 4086 4086
Misses 13 13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Owner
|
Nice, thanks! |
This was referenced Jul 28, 2026
adbar
pushed a commit
that referenced
this pull request
Jul 29, 2026
…ed on Windows (#893) The 'Lint and format check' step runs two commands in one run: block. With no shell: key GitHub uses pwsh on Windows, where the step's exit status comes from $LASTEXITCODE of the last command only. 'ruff format --check' passes, so a preceding 'ruff check' failure is discarded and the job reports success. On Linux and macOS the same block runs under 'bash -e' and aborts on the first failure. Observed in run 30165454624 (2026-07-25, before #892): every ubuntu and macos job failed at this step, while build (windows-latest, 3.11) reported success. Its log contains 'Found 103 errors.' immediately followed by '41 files already formatted'. Setting shell: bash gives all three runners the same behaviour. Co-authored-by: Igor Saevets <igorsaevets@gmail.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 is currently red on every pull request, and the cause is outside the changed code.
What happened
ruff 0.16.0 (released 2026-07-25) widened its default rule selection from 59 rules to 413.
pyproject.tomlasks forruff >= 0.15with no upper bound and does not configure[tool.ruff.lint] select, so CI installs whatever is newest and lints against the new defaults.Reproduced against unmodified
masterat 3d89493, no other changes in the tree:ruff check .All checks passed!Found 103 errors.The 103 findings are spread over 31 files and come from rule families that were not previously on by default:
BLE001(22),I001(18),FURB167(12),UP031(11),SIM102(5), plusRUF,DTZ,S,PL,B,PIE,FLYandC4. None of them are new code.Confirming it is only the selection and nothing else in the release:
The change
One block in
pyproject.tomlselectingE4,E7,E9,Fexplicitly. Those are ruff's pre-0.16 defaults, so linting behaviour is unchanged from what the repository has been enforcing, and it no longer moves when ruff changes its mind about defaults.This is the same reasoning already written down a few lines below for mypy in that file:
Verified after the change:
ruff formatwas never affected; only the lint step was.Not included on purpose
Adopting any of the newly-default rules is a separate judgement call, and 103 mechanical edits do not belong in the same change as a CI repair. Roughly 43 are auto-fixable if you want them. Happy to open a follow-up per rule family, or to add an upper bound like
ruff >= 0.15, < 0.17instead if you prefer pinning the tool over pinning the selection. Your call and I will match whatever you pick.Found this while checking why #891 was red. That PR touches only
htmlprocessing.py,xml.pyandtests/unit_tests.pyand contributes none of the 103 findings.