Skip to content

rtk ruff check --statistics prints ruff's statistics JSON instead of its table, larger than ruff's own output #4701

Open

Description

@KuSh

rtk ruff injects --output-format=json into every check run where the user did not pick a format. With --statistics, ruff then prints statistics as JSON ([{"code","name","count","fixable","fixable_count"}]). That is not the diagnostics array filter_ruff_check_json expects, so the JSON comes back as-is: larger than ruff's table and in a different shape.

Reproduction (ruff 0.16.6, LC_ALL=C, 61 files with unused imports and unsorted import blocks):

command stdout
ruff check --statistics src 116 B: 242\tF401\t[*] unused-import, 60\tI001\t[*] unsorted-imports, totals
rtk ruff check --statistics src (develop 5ab6291) 248 B of pretty-printed JSON, exit 1

#3968 also routes the flag-first spelling rtk ruff --statistics to this path.

Direction: leave --output-format alone when --statistics is present (ruff's table is already compact), or summarise the statistics JSON.

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 93%

    Summary

    rtk ruff check --statistics forces JSON output format, which bypasses the statistics table filter and prints larger, wrongly-shaped JSON instead of ruff's compact table.

    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

    Suggested Actions

    1. Skip injecting --output-format=json when --statistics is present among the args
    2. Related to fix(ruff): route flag-first implicit check invocations to check (#3927) #3968 which routes flag-first rtk ruff --statistics through the same code path
    3. Alternatively, extend the filter to parse and summarise the statistics JSON shape instead
    4. Add a regression test covering rtk ruff check --statistics and rtk ruff --statistics

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

  3. added a commit that references this issue on Oct 31, 2026
    af052f7
  4. added a commit that references this issue on Nov 28, 2026
    e44d906
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