Skip to content

rtk ruff -- <path> drops the leading --, so rtk ruff -- check lints the whole directory #4702

Closed

Description

@KuSh

Commands::Ruff hands its args to ruff_cmd::run without core::args_utils::restore_double_dash, so clap's leading -- is gone before routing. A path after it is then read as the first argument.

Reproduction (ruff 0.16.6, LC_ALL=C, a clean file named check in a directory with 60 dirty modules):

command result
ruff check -- check All checks passed!, exit 0
rtk ruff check -- check Ruff: No issues found, exit 0
rtk ruff -- check (develop 5ab6291) 361 files linted, exit 1

A -- later in argv survives (rtk ruff --isolated -- check forwards it). First reported by @Protocol-zero-0 in #3968 (review).

Direction: restore the -- as the other passthrough commands do (restore_double_dash).

Activity

  1. added
    bug
    good first issue
    on Oct 21, 2026
  2. rtk-wshm-sync-bot commented on Oct 21, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 95%

    Summary

    rtk ruff -- <path> loses the leading -- before dispatch, causing the path to be misread and the whole directory linted instead; fix by applying restore_double_dash as other passthrough commands do.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/core/args_utils.rs
    • src/ruff_cmd.rs

    Suggested Actions

    1. Apply restore_double_dash in Commands::Ruff handling before calling ruff_cmd::run, mirroring other passthrough co…
    2. Add a regression test for rtk ruff -- <path> to prevent recurrence
    3. Cross-check related ruff passthrough bugs rtk ruff reads the subcommand from fixed positions, so ruff global options make rtk ruff --isolated analyze graph truncate the JSON #4654/rtk ruff cuts SARIF, JUnit, GitLab, JSON Lines and rule --output-format=json output at the passthrough cap #4655 for shared root cause in arg handling

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. Yathiskumar commented on Oct 21, 2026

    @Yathiskumar
    Contributor

    Reproduced on develop @5ab62913 (macOS, ruff 0.16.6). With a clean file named check next to 60 modules that each have unused imports:

    • ruff check -- check → All checks passed!, exit 0
    • rtk ruff check -- check → Ruff: No issues found, exit 0
    • rtk ruff -- check → lints the whole directory, 120 issues, exit 1

    I'd like to pick this up. Plan is to call restore_double_dash in the Commands::Ruff arm like the other passthrough commands, with a failing test for rtk ruff -- check first. Will open a PR against develop.

  4. added a commit that references this issue on Oct 23, 2026
    b1701fb
  5. added 2 commits that reference this issue on Nov 2, 2026
    fd68451
    e3dc290
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibuggood first issuepriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions