Skip to content

Chore: Pin ruff rule selection - #336

Merged
tykeal merged 1 commit into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:chore/pin-ruff-rule-selection
Jul 30, 2026
Merged

Chore: Pin ruff rule selection#336
tykeal merged 1 commit into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:chore/pin-ruff-rule-selection

Conversation

@ModeSevenIndustrialSolutions

Copy link
Copy Markdown
Contributor

Why

Without a select, ruff applies its default rule set, and 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 changes which rules run, on code nobody has touched. That is exactly what fails the open autoupdate PR #333 here.

Deliberately narrow

The selection is precisely the rule set this repository already satisfies, so pinning changes no behaviour today: both ruff 0.15.22 and 0.16.0 report all checks passing.

Adopting the wider organisation superset (E, W, F, I, B, C4, UP) is worthwhile but belongs in its own reviewed change — it currently reports 22 findings, 14 auto-fixable, with 6 B904 raise-without-from sites needing judgement about which exception context to preserve. Folding an error-handling refactor into a configuration chore would obscure both.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions requested review from a team and Copilot July 30, 2026 12:17
@github-actions github-actions Bot added the chore Code chores (dependency updates, etc) label Jul 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repository’s Ruff configuration to explicitly pin which lint rules are selected, aiming to prevent CI/pre-commit behavior changes when Ruff’s default rule set shifts between releases.

Changes:

  • Add [tool.ruff.lint] with an explicit select rule set and an ignore for E501.
  • Add [tool.ruff.lint.per-file-ignores] for tests/**/*.py to pre-emptively suppress rules that are expected to be relaxed in tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml
Comment thread pyproject.toml Outdated
Without a select, ruff applies its default rule set, and that default
is not stable across releases: 59 rules across 2 categories in 0.15.22,
413 across 38 in 0.16.0. A routine pre-commit autoupdate crossing that
boundary changes which rules run, on code nobody has touched. That is
what currently fails the open autoupdate pull request here.

The selection is deliberately narrow. It is exactly the rule set this
repository already satisfies, so pinning changes no behaviour today
and both ruff 0.15.22 and 0.16.0 report all checks passing.

Adopting the wider organisation superset is worthwhile but belongs in
its own reviewed change. It currently reports 22 findings, 14 of them
auto-fixable; the remainder are 6 B904 raise-without-from sites that
need judgement about which exception context to preserve. Folding a
refactor of error handling into a configuration chore would obscure
both.

The test per-file-ignores list rules that are not selected yet, so that
widening the selection later does not immediately flag every test
module. PLR0917 is there because tests stacking @patch decorators
cannot satisfy it: unittest.mock injects each mock positionally, so a
keyword-only signature is impossible rather than merely inconvenient.

Co-authored-by: Claude <claude@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
Copilot AI review requested due to automatic review settings July 30, 2026 12:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@tykeal
tykeal merged commit 749953a into lfreleng-actions:main Jul 30, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Code chores (dependency updates, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants