Repository navigation
fix(lint): skip ruff with a warning when the repository doesn't pin it - #568
DevSecNinja wants to merge 1 commit into
Conversation
Pinning ruff in the repository's mise config is the opt-in. A repository with Python files but no ruff pin now gets a warning that names the fix (pin ruff, add a ruff config) and a passing step instead of a failed ruff job, so the lint.yml bump doesn't turn CI red in repositories that haven't adopted ruff. Once ruff is pinned, findings fail as before. Closes #567 Refs #539 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change making ruff opt-in through repository mise pins.
No open issues 🎉
What changed in this PR
Makes ruff opt-in through a repository’s mise pin, preventing shared lint workflow updates from failing Python repositories that have not adopted it. This addresses #567 while preserving failures for ruff findings once the tool is pinned.
Changes:
- Skip unpinned ruff with an actionable warning and a successful exit.
- Add regression checks for the unpinned and no-Python-file cases.
- Document the opt-in behavior in architecture guidance, workflow inputs, and the caller template.
| File | Description |
|---|---|
workflow-templates/lint.yml |
Clarifies the pin requirement and warning behavior in template comments. |
tests/lint-scripts.sh |
Checks skip behavior, warnings, and absence of ruff execution or SARIF output. |
scripts/lint/ruff.sh |
Detects Python files first, then warns and exits successfully when ruff is unavailable. |
docs/architecture.md |
Explains pin-based adoption of language linters. |
.github/workflows/lint.yml |
Updates the lint-ruff input description to mention pinning. |
.github/workflows/lint-include.yml |
Aligns the lint-ruff input description with the shared workflow. |
Review effort: Balanced
|
@coderabbitai review |
Action not completed
|
Description
ruff (from #562, not yet released) failed in every Python repository that doesn't pin ruff in its mise config. A read-only check of the fleet found 8 managed repos with Python files and a
lint.ymlcaller, and none of them pins ruff, so the release would have turned each one's ruff check (or whole workflow, withlint-fail-on-error) red.Pinning ruff is now the opt-in. Without the pin,
scripts/lint/ruff.shskips ruff with a warning that names the fix, and the step passes. Once ruff is pinned, findings fail as before.Closes #567
Refs #539
Changes
scripts/lint/ruff.sh: lists the Python files first (no files: a notice, as before). If ruff isn't pinned (mise which rufffails), it emits::warning title=ruff is not pinned::with the fix (pin ruff in.mise.toml, addruff.tomlor[tool.ruff]inpyproject.toml, or setlint-ruff: false) and exits 0. The genericrequire-mise-tool.sherror no longer applies to ruff.tests/lint-scripts.sh: an unpinned ruff warns, passes, and doesn't run ruff or report SARIF; a repo without Python files doesn't warn about the pin.docs/architecture.mddescribes the opt-in rule for language linters, and thelint-ruffinput descriptions and workflow template say so too. Biome and PSScriptAnalyzer (feat(lint): run Biome when the repository has JavaScript, TypeScript, JSON or CSS files #563, feat(lint): run PSScriptAnalyzer when the repository has PowerShell files #564) apply the same rule.Checklist
mise exec -- lefthook run pre-commit): this repo has no lefthook config, so I ran shellcheck, shfmt, yamlfmt, yamllint, actionlint and dprint on the changed files. All clean.Tests run locally:
tests/lint-scripts.sh,tests/lint-include.pyandtests/lint-job-modes-contract.shpassed. I also ranruff.shagainst a scratch repo with real mise: without the pin it printed the warning and exited 0; withruff = "0.17.5"pinned it reported F401 and exited 1.