Chore: Pin ruff rule selection - #147
Merged
askb merged 1 commit intoJul 30, 2026
Merged
Conversation
Copilot started reviewing on behalf of
ModeSevenIndustrialSolutions
July 28, 2026 14:10
View session
There was a problem hiding this comment.
Pull request overview
Adds an explicit Ruff configuration file to pin the enabled lint rule set, preventing Ruff’s evolving defaults from causing unexpected lint failures on version bumps.
Changes:
- Introduces
.ruff.tomlwith an explicit[lint].selectset (E,W,F,I,B,C4,UP) and targeted ignores (E501,B008). - Adds
lint.per-file-ignoresfortests/**/*.pyto reduce test-only noise when the selected ruleset is widened later.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tykeal
previously approved these changes
Jul 28, 2026
tykeal
left a comment
Contributor
There was a problem hiding this comment.
🤖 Dependamerge
Approved this pull request ✅
ModeSevenIndustrialSolutions
force-pushed
the
chore/pin-ruff-rule-selection
branch
from
July 28, 2026 16:50
d1c7c47 to
c0a3987
Compare
Copilot started reviewing on behalf of
ModeSevenIndustrialSolutions
July 28, 2026 16:50
View session
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
.ruff.toml:41
- The file currently ends with a whitespace-only line, which will be flagged by the existing
trailing-whitespacepre-commit hook. Remove the trailing whitespace/extra blank line so the repo stays clean under pre-commit.
"tests/**/*.py" = ["S101", "ARG", "PLR0913", "PLR0917", "PLR2004"]
Copilot started reviewing on behalf of
ModeSevenIndustrialSolutions
July 28, 2026 17:20
View session
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
.ruff.toml:18
- The comment text "Pinning does not decline the unselected rules" is misleading/awkward here: with a
selectlist, Ruff disables all unselected rules, so this can read as if unselected rules still run. Reword to make it explicit that unselected rules are switched off, and that adding more rules later is a deliberate config change.
# Pinning does not decline the unselected rules. It makes adopting them
# a deliberate, reviewed change instead of a side effect of a version
# bump.
.ruff.toml:24
- "de-facto" is typically written as "de facto" (no hyphen) in standard usage, including attributive use.
# The de-facto standard across this organisation: present as a superset
This repository runs the ruff hook with no ruff configuration, so it
applies whatever ruff's *default* rule set happens to be. That default
is not stable across releases:
ruff 0.15.22 -> 59 rules across 2 categories (E, F)
ruff 0.16.0 -> 413 rules across 38 categories
A routine pre-commit autoupdate crossing that boundary changed which
rules run and broke fifteen repositories in this organisation at once,
on code nobody had touched. Ninety-six repositories carry the hook
with no configuration, so all of them are exposed to the next bump.
Pin the rule set to the de-facto house style, which appears as a
superset in 13 of the 16 repositories that already pin their own. This
does not decline the unselected rules; it makes adopting them a
deliberate, reviewed change rather than a side effect of a version bump.
line-length and target-version are left unset on purpose. Both alter
existing behaviour -- target-version changes which pyupgrade rules fire
-- and the aim here is to fix which rules run, nothing else.
No code changes accompany this: the tree is already clean under the
pinned rule set, verified with ruff 0.16.0 against the files the hook
currently selects.
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
ModeSevenIndustrialSolutions
force-pushed
the
chore/pin-ruff-rule-selection
branch
from
July 28, 2026 17:28
fc8d8d8 to
0da2137
Compare
askb
approved these changes
Jul 30, 2026
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.
Why
This repo runs the ruff hook with no ruff configuration, so it applies whatever ruff's default rule set happens to be. That default is not stable across releases — verified directly:
A 7× expansion in a patch-level bump. The routine autoupdate that crossed it broke 15 repos in this org simultaneously on untouched code — including this one, where #146 is blocked on 5 violations.
What
Not invented — this is the de facto house style, a superset in 13 of the 16 org repos that already pin their rules.
A standalone
.ruff.tomlbecause this repo has nopyproject.toml.Selecting these categories switches every other rule off — that is the point. Adopting them becomes a deliberate, reviewed change rather than a side effect of a version bump.
line-lengthandtarget-versionare left unset on purpose — both would change behaviour rather than pin it (target-versionalters whichpyupgraderules fire). Standardising those is separate work.Effect on #146
All 5 blocking violations fall outside the pinned set and cease to exist:
EXE001EXEnot selectedPIE810PIEnot selectedBLE001BLEnot selectedSIM115SIMnot selectedThe last two were the ones needing a judgement call:
BLE001wraps atomllib.load, andSIM115flags theemit()helper's conditional file handle (open(...) if target else sys.stdout), which already has correcttry/finallycleanup and simply cannot be expressed as a plain context manager. This removes the need to contort either.Validation
ruff check --show-settingsconfirms enabled categories drop from 38 toB C E F I UP Wpre-commit run --all-files→ all hooks pass