Skip to content

Chore: Pin ruff rule selection - #103

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

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

Conversation

@ModeSevenIndustrialSolutions

@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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:

$ ruff 0.15.22 check --show-settings --isolated
 59 rules across  2 categories (E, F)

$ ruff 0.16.0 check --show-settings --isolated
413 rules across 38 categories

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 #102 is blocked.

What

[lint]
select = ["E", "W", "F", "I", "B", "C4", "UP"]
ignore = ["E501", "B008"]

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.toml because this repo has no pyproject.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-length and target-version are left unset on purpose — both would change behaviour rather than pin it (target-version alters which pyupgrade rules fire). Standardising those is separate work.

Effect on #102

The single blocking violation falls outside the pinned set and ceases to exist: EXE001 on tests/test-projects.py:1 (shebang present, file not executable). EXE is not selected.

Worth noting the alternative was to delete a shebang from a file that is mode 644 and never invoked directly — a change with no benefit beyond satisfying a rule the org had not chosen to adopt.

Validation

  • No code changes needed — verified clean under the pinned set with ruff 0.16.0 against the files the hook selects
  • ruff check --show-settings confirms enabled categories drop from 38 to B C E F I UP W
  • pre-commit run --all-files → all hooks pass

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions requested review from a team and Copilot July 28, 2026 14:09
@github-actions github-actions Bot added the chore Code chores (dependency updates, etc) label Jul 28, 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

Adds an explicit Ruff configuration file to pin the repo’s lint rule selection, avoiding unexpected rule-set changes when the Ruff/pre-commit hook version is updated.

Changes:

  • Introduces a standalone .ruff.toml (since there’s no pyproject.toml) with an explicit [lint] select list.
  • Defines a small ignore list (E501, B008) and test-specific per-file ignores to prevent future select-expansions from immediately flagging test suites.

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

tykeal
tykeal previously approved these changes Jul 28, 2026

@tykeal tykeal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Dependamerge
Approved this pull request ✅

Copilot AI review requested due to automatic review settings July 28, 2026 16:50

This comment was marked as outdated.

This comment was marked as resolved.

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>

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 d77f6be into lfreleng-actions:main Jul 29, 2026
9 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