ci: pin the Ruff rule set explicitly so a Ruff default-expansion can't red CI#3705
Closed
jawwad-ali wants to merge 1 commit into
Closed
ci: pin the Ruff rule set explicitly so a Ruff default-expansion can't red CI#3705jawwad-ali wants to merge 1 commit into
jawwad-ali wants to merge 1 commit into
Conversation
…t red CI CI runs `uvx ruff check src tests`, which always resolves the LATEST Ruff. The config used `extend-select` on top of Ruff's *default* select, so a Ruff release that expands the default rule set starts failing long-standing code repo-wide — `uvx ruff check src tests` on a clean main currently reports ~1476 findings (733 I001, 161 UP006, 105 RUF012, 92 PLW1510, ...), none of which the project selects. Replace `extend-select` with an explicit `select` that reproduces Ruff's historical default (E4/E7/E9/F) plus the subprocess-security rules (S602/S604/S605) the project has always enforced. This makes the rule set version-independent: `uvx ruff check src tests` passes again, and the shell=True/os.system guards still fire (verified). No source changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Closing this as superseded. After opening this I confirmed that #3695 already pinned the Ruff version in CI ( Under the pinned |
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.
Problem
The
ruffCI job runsuvx ruff check src tests, anduvx ruff(unpinned) always resolves the latest Ruff. The lint config builds on Ruff's default select viaextend-select, so a Ruff release that expands the default rule set starts failing long-standing code across the whole repo.Right now,
uvx ruff check src testson a cleanmainreports ~1476 findings — dominated by rules the project doesn't select:This affects every open PR (older PRs show a cached green from before the Ruff release).
Fix
Replace
extend-selectwith an explicitselectthat reproduces Ruff's historical default (E4/E7/E9/F) plus the subprocess-security rules the project has always enforced (S602/S604/S605). This pins the rule set (independent of Ruff's version), which is more robust than pinning a Ruff version.Verification
uvx ruff check src tests→ All checks passed! (was ~1476 errors)subprocess.run("ls", shell=True)probe is still flaggedS602.pyproject.tomlonly.(If you'd instead prefer to adopt the new default rules or pin a specific Ruff version, happy to adjust — this is the minimal change to restore green CI without a repo-wide auto-fix.)
AI-assisted: authored with Claude Code. I confirmed the 1476 findings are all from rules outside the project's intended set and that the explicit
selectrestores green while preserving the S6xx security posture.