chore(deps): sync ruff 0.16.0 pins - #2812
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRuff is upgraded from ChangesRuff maintenance
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@templates/consumer-repo/.github/workflows/autofix-versions.env`:
- Line 8: Revert the RUFF_VERSION change in the repo-specific
autofix-versions.env template to the shared Ruff pin. Only retain 0.16.0 if this
consumer repository uniquely requires it and the exception is documented
according to the path instructions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7d22e803-660d-455e-94e0-12bec8e43b20
⛔ Files ignored due to path filters (1)
requirements.lockis excluded by!**/*.lock,!**/*.lock
📒 Files selected for processing (4)
.github/workflows/autofix-versions.envpyproject.tomltemplates/consumer-repo/.github/workflows/autofix-versions.envtemplates/integration-repo/.github/workflows/autofix-versions.env
| # in each consumer repo's pyproject.toml directly, NOT synced from this file. | ||
| BLACK_VERSION=26.5.1 | ||
| RUFF_VERSION=0.15.22 | ||
| RUFF_VERSION=0.16.0 |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Do not update this repo-specific template for the shared Ruff pin.
Revert this line unless 0.16.0 is uniquely required by the consumer repository and that exception is documented. As per path instructions, “Keep autofix-versions.env as repo-specific; edit locally only for dependency pins unique to this repository.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@templates/consumer-repo/.github/workflows/autofix-versions.env` at line 8,
Revert the RUFF_VERSION change in the repo-specific autofix-versions.env
template to the shared Ruff pin. Only retain 0.16.0 if this consumer repository
uniquely requires it and the exception is documented according to the path
instructions.
Source: Path instructions
Automated Status SummaryHead SHA: 00c6734
Coverage Overview
Coverage Trend
Top Coverage Hotspots (lowest coverage)
Low Coverage Files (<50.0%)
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/reusable-10-ci-python.yml:
- Around line 1091-1094: Update the Ruff invocation in the CI workflow so the
legacy E4,E7,E9,F rule family is applied only when the consumer has not declared
a custom tool.ruff.lint.select configuration; otherwise preserve the consumer’s
selection. Keep the existing .workflows-lib exclusion and GitHub output behavior
unchanged.
In `@tests/workflows/test_reusable_ci_workflow.py`:
- Line 135: Update the Ruff command assertion in the relevant workflow test to
compare the complete non-comment command line exactly, including output-format
and exclusion options, rather than checking whether a partial string appears in
ruff_step["run"].
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5920fb2f-5f3c-4451-bbed-d5a31683a803
📒 Files selected for processing (5)
.github/workflows/reusable-10-ci-python.ymldocs/ci/TOOL_VERSION_MANAGEMENT.mdtests/workflows/test_autofix_full_pipeline.pytests/workflows/test_autofix_pipeline_diverse.pytests/workflows/test_reusable_ci_workflow.py
| # Keep the pre-0.16 default rule family stable for consumers that do | ||
| # not declare their own Ruff selection. Exclude .workflows-lib since | ||
| # it is synced from the source repo with different Ruff configuration. | ||
| ruff check --select E4,E7,E9,F --output-format github --extend-exclude .workflows-lib . |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the workflow and nearby tests/fixtures that mention Ruff selection.
git ls-files '.github/workflows/reusable-10-ci-python.yml' 'templates/consumer-repo/.github/workflows/reusable-10-ci-python.yml' | cat
printf '\n---\n'
rg -n --hidden --glob '!**/.git/**' --glob '!**/node_modules/**' 'ruff check|--select E4,E7,E9,F|tool\.ruff\.lint\.select|ruff selection|pre-0\.16' .github templates test tests . | sed -n '1,220p'Repository: stranske/Workflows
Length of output: 9656
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the relevant workflow section and any companion test file around Ruff handling.
python3 - <<'PY'
from pathlib import Path
paths = [
Path('.github/workflows/reusable-10-ci-python.yml'),
Path('templates/consumer-repo/.github/workflows/reusable-10-ci-python.yml'),
]
for p in paths:
if p.exists():
print(f"\n### {p}\n")
text = p.read_text().splitlines()
for i, line in enumerate(text, 1):
if 'ruff check' in line or '--select E4,E7,E9,F' in line or 'workflows-lib' in line:
start = max(1, i-8)
end = min(len(text), i+8)
for j in range(start, end+1):
print(f"{j:4d}: {text[j-1]}")
print()
PYRepository: stranske/Workflows
Length of output: 13280
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Search for workflow tests that assert Ruff behavior or consumer-specific selections.
fd -a -t f '.*(test|spec|fixture).*' .github templates test tests . | sed -n '1,200p'Repository: stranske/Workflows
Length of output: 13687
🌐 Web query:
Ruff CLI --select precedence over pyproject.toml tool.ruff.lint.select configuration command line overrides config
💡 Result:
Yes, Ruff command-line interface (CLI) options take precedence over those defined in pyproject.toml [1][2][3]. When Ruff determines which rules to enforce, it follows a hierarchical resolution strategy: 1. CLI options are given the highest priority [1][2]. 2. The current pyproject.toml (or ruff.toml) file is given the next highest priority [1][2]. 3. Inherited pyproject.toml files have the lowest priority [1][2]. Specifically regarding rule selection, Ruff uses the highest-priority lint.select configuration as the foundation for the rule set [1][3]. Once this basis is established, it then applies any extend-select, ignore, and extend-ignore adjustments [1][2][3]. For example, if your pyproject.toml defines a set of rules via select, providing a different --select flag on the command line will effectively override and reset that selection based on the CLI input, rather than merging with the file-based configuration [2]. Similarly, the --config flag can be used to provide arbitrary TOML-based overrides, which take precedence over all configuration files [4][5][6].
Citations:
- 1: https://github.com/astral-sh/ruff/blob/77b9cc56/docs/linter.md
- 2: https://github.com/astral-sh/ruff/blob/85ca6cde49a76df88dafc47784a8c7629782f9d6/BREAKING_CHANGES.md
- 3: https://docs.astral.sh/ruff/linter/
- 4: https://docs.astral.sh/ruff/configuration/?featured_on=pythonbytes
- 5: https://docs.astral.sh/ruff/configuration/
- 6: https://github.com/astral-sh/ruff/blob/main/docs/configuration.md
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Print the surrounding workflow block to see whether the Ruff command is gated.
python3 - <<'PY'
from pathlib import Path
p = Path('.github/workflows/reusable-10-ci-python.yml')
text = p.read_text().splitlines()
for idx, line in enumerate(text, 1):
if '--select E4,E7,E9,F' in line:
start = max(1, idx-30)
end = min(len(text), idx+30)
for j in range(start, end+1):
print(f"{j:4d}: {text[j-1]}")
break
PYRepository: stranske/Workflows
Length of output: 2951
🌐 Web query:
Ruff command-line options precedence configuration file select ignore extend-select docs
💡 Result:
In Ruff, configuration precedence follows a clear hierarchy. When settings conflict, the following order applies (from highest to lowest priority) [1]: 1. Dedicated command-line flags (e.g., --select, --line-length) [2][3][4] 2. TOML configuration overrides passed via --config (e.g., --config "lint.line-length=100") [2][1][4] 3. Configuration files explicitly specified via --config [2][1] 4. Hierarchically discovered configuration files (pyproject.toml, ruff.toml,.ruff.toml) [2][1] 5. Default settings [1] If multiple configuration files are detected in the same directory, the priority order is.ruff.toml > ruff.toml > pyproject.toml [2][5]. Regarding rule selection (select, ignore, extend-select, extend-ignore), Ruff resolves the final rule set by reconciling these options across all sources [6]. CLI flags, such as --select, take precedence over corresponding settings in configuration files [6][7]. For extending or modifying rule sets, extend-select and extend-ignore are used to add or remove rules relative to the base configuration [8][6]. Because Ruff processes these rules specifically to allow child configurations to override parent ones, extend-select can effectively re-enable rules that were previously ignored [9][10]. When both a dedicated flag (like --select) and a --config override are provided for the same setting, the dedicated flag takes priority [2][4]. The --isolated flag causes Ruff to ignore all configuration files, relying only on defaults and any explicit command-line overrides [2][1].
Citations:
- 1: https://deepwiki.com/astral-sh/ruff/6.4-ruff-command-line-interface
- 2: https://docs.astral.sh/ruff/configuration/
- 3: https://github.com/astral-sh/ruff/blob/77b9cc56/crates/ruff/src/args.rs
- 4: https://github.com/astral-sh/ruff/blob/b16565ef/docs/configuration.md
- 5: https://docs.astral.sh/ruff/configuration/?featured_on=pythonbytes
- 6: https://docs.astral.sh/ruff/linter/
- 7: ignore configuration from pyproject.toml is ignored when using --select from the CLI astral-sh/ruff#18352
- 8: https://docs.astral.sh/ruff/settings/
- 9: Document that extend-select wins over more specific ignore astral-sh/ruff#1838
- 10: Overwrite ignore values from config from cli command astral-sh/ruff#15403
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the reusable CI workflow test and search for any consumer Ruff-selection fixtures.
python3 - <<'PY'
from pathlib import Path
targets = [
Path('tests/workflows/test_reusable_ci_workflow.py'),
Path('templates/consumer-repo'),
Path('.github/workflows/reusable-10-ci-python.yml'),
]
for p in targets:
if p.is_file():
print(f"\n### {p}\n")
text = p.read_text().splitlines()
for i, line in enumerate(text, 1):
if 'ruff' in line.lower() or 'select E4,E7,E9,F' in line:
start = max(1, i-12)
end = min(len(text), i+20)
for j in range(start, end+1):
print(f"{j:4d}: {text[j-1]}")
print()
elif p.is_dir():
print(f"\n### search in {p}\n")
import subprocess, shlex
subprocess.run(["rg", "-n", "tool\\.ruff\\.lint\\.select|ruff\\.lint\\.select|\\bselect\\s*=\\s*\\[|\\bselect\\s*=\\s*\"", str(p)], check=False)
PYRepository: stranske/Workflows
Length of output: 50374
Preserve consumer Ruff selections. ruff check --select E4,E7,E9,F overrides any tool.ruff.lint.select, so this is not a fallback for repos that define their own selection. Gate the legacy rule family on the absence of consumer config, or make the override explicit and add a fixture for a custom Ruff selection.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/reusable-10-ci-python.yml around lines 1091 - 1094, Update
the Ruff invocation in the CI workflow so the legacy E4,E7,E9,F rule family is
applied only when the consumer has not declared a custom tool.ruff.lint.select
configuration; otherwise preserve the consumer’s selection. Keep the existing
.workflows-lib exclusion and GitHub output behavior unchanged.
Source: Path instructions
| steps = workflow["jobs"]["lint-ruff"]["steps"] | ||
| ruff_step = next(step for step in steps if step.get("name") == "Ruff (lint)") | ||
|
|
||
| assert "ruff check --select E4,E7,E9,F" in ruff_step["run"] |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Assert the complete Ruff command, not a substring.
The current assertion could pass if the text appears in a comment or unrelated shell fragment, and it does not protect the output-format or exclusion options. Match the non-comment command line exactly.
Suggested test adjustment
- assert "ruff check --select E4,E7,E9,F" in ruff_step["run"]
+ commands = [
+ line.strip()
+ for line in ruff_step["run"].splitlines()
+ if line.strip() and not line.lstrip().startswith("#")
+ ]
+ assert (
+ "ruff check --select E4,E7,E9,F --output-format github "
+ "--extend-exclude .workflows-lib ." in commands
+ )📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| assert "ruff check --select E4,E7,E9,F" in ruff_step["run"] | |
| commands = [ | |
| line.strip() | |
| for line in ruff_step["run"].splitlines() | |
| if line.strip() and not line.lstrip().startswith("#") | |
| ] | |
| assert ( | |
| "ruff check --select E4,E7,E9,F --output-format github " | |
| "--extend-exclude .workflows-lib ." in commands | |
| ) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/workflows/test_reusable_ci_workflow.py` at line 135, Update the Ruff
command assertion in the relevant workflow test to compare the complete
non-comment command line exactly, including output-format and exclusion options,
rather than checking whether a partial string appears in ruff_step["run"].
|
Runner dispatch state for autofix on PR #2812. Do not edit. |
|
Superseded by #2840, which carries the full shared Ruff 0.16 pin surface and preserves consumer-defined Ruff selections. |
Updates the canonical Ruff pin together with Workflows development metadata, lockfile, and consumer/integration template environments. This replaces partial consumer-only Ruff updates.\n\nValidation:\n-
python scripts/sync_tool_versions.py --check\n-python scripts/validate_version_pins.py\n-pytest -q tests/scripts/test_sync_tool_versions.py tests/scripts/test_validate_version_pins.pySummary by CodeRabbit