Skip to content

filter_ruff_format matches pre-0.12 ruff wording, so rtk ruff format --check compresses nothing #3930

Open

Description

@KuSh

filter_ruff_format keys off two strings:

if lower.contains("would reformat:") { … }
if lower.contains("left unchanged") { … }

ruff stopped emitting both in check mode. On ruff 0.16.6 format --check prints unformatted: File would be reformatted per file and N files already formatted as the summary, so neither branch fires and the filter falls through to result.push_str(output.trim()) — an identity function over the full ANSI diagnostic block.

Reproduction (ruff 0.16.6, LC_ALL=C, 2 files, 1 unformatted)

$ ruff format --check . | wc -c        # 886
$ rtk ruff format --check . | wc -c    # 886   -> 0.0% savings

Against CONTRIBUTING.md's 20% floor, the format path currently delivers nothing. ruff format (write mode) still says 1 file left unchanged and is still summarised correctly, so only the --check path is dead.

Verified identical on develop (665b272) and on #3083's head — this predates that PR and is out of its scope.

Suggested direction

Match the current wording as well: unformatted: for the per-file lines and already formatted alongside left unchanged for the summary. Keeping both spellings covers old and new ruff. The existing test_filter_ruff_format_needs_formatting / test_filter_ruff_format_all_formatted fixtures use the pre-0.12 strings and pass, which is why the drift went unnoticed — new fixtures should be captured from a current ruff.

Activity

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

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 95%

    Summary

    filter_ruff_format only matches pre-0.12 ruff wording, so rtk ruff format --check output on ruff 0.16+ passes through uncompressed; add matching for unformatted: and already formatted.

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

    📁 Relevant files
    • src/filters/ruff.rs

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

  3. cestercian commented on Sep 9, 2026

    @cestercian

    Taking this — will teach filter_ruff_format to recognize current ruff check wording (unformatted: / N files already formatted) while keeping the pre-0.12 spellings, plus fixtures from current ruff.

  4. added a commit that references this issue on Oct 12, 2026
    860b380
  5. added a commit that references this issue on Nov 18, 2026
    85b6b95
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