Skip to content

fix(lint): skip ruff with a warning when the repository doesn't pin it - #568

Open
DevSecNinja wants to merge 1 commit into
mainfrom
devsecninja-feat-lint-language-linters
Open

DevSecNinja wants to merge 1 commit into
mainfrom
devsecninja-feat-lint-language-linters

Conversation

@DevSecNinja

Copy link
Copy Markdown
Owner

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.yml caller, and none of them pins ruff, so the release would have turned each one's ruff check (or whole workflow, with lint-fail-on-error) red.

Pinning ruff is now the opt-in. Without the pin, scripts/lint/ruff.sh skips 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 ruff fails), it emits ::warning title=ruff is not pinned:: with the fix (pin ruff in .mise.toml, add ruff.toml or [tool.ruff] in pyproject.toml, or set lint-ruff: false) and exits 0. The generic require-mise-tool.sh error 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: docs/architecture.md describes the opt-in rule for language linters, and the lint-ruff input 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

  • Linting passes locally (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.
  • Commit messages follow Conventional Commits
  • Documentation updated (if applicable)

Tests run locally: tests/lint-scripts.sh, tests/lint-include.py and tests/lint-job-modes-contract.sh passed. I also ran ruff.sh against a scratch repo with real mise: without the pin it printed the warning and exited 0; with ruff = "0.17.5" pinned it reported F401 and exited 1.

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>
@DevSecNinja
DevSecNinja requested a balanced review from Copilot November 17, 2026 15:01
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dae2d49b-5423-48f4-8728-42a6327f14cd
Commits

Reviewing files that changed from the base of the PR and between e416a44 and 29ed9cd.

Files selected for processing: 6

  • .github/workflows/lint-include.yml
  • .github/workflows/lint.yml
  • docs/architecture.md
  • scripts/lint/ruff.sh
  • tests/lint-scripts.sh
  • workflow-templates/lint.yml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

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.

🟢 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

@DevSecNinja

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(lint): skip ruff with a warning when the repository doesn't pin it

2 participants