Skip to content

fix(ruff): preserve selected output formats and shell completions - #4896

Open
Protocol-zero-0 wants to merge 1 commit into
rtk-ai:developfrom
Protocol-zero-0:fix/ruff-complete-documents
Open

Protocol-zero-0 wants to merge 1 commit into
rtk-ai:developfrom
Protocol-zero-0:fix/ruff-complete-documents

Conversation

@Protocol-zero-0

Copy link
Copy Markdown
Contributor

Fixes #4655.

Selected Ruff output formats, rule documentation and generated shell completions are currently summarized or truncated. For example, rtk ruff generate-shell-completion bash returns 2,001 bytes and an invalid script instead of Ruff's complete output. This change sends explicitly selected --output-format documents and the routed rule / generate-shell-completion commands through the existing native passthrough, preserving stdout bytes, stderr and exit status, including documents above the capture limit. Default checks keep their summary. Missing output-format values are forwarded to native validation without injecting a second format or a default path.

The output-format lookup uses the existing tokenizer, consuming global option values and respecting --. A path named --output-format=json stays a path. This consolidates the two patches already shared on #4655 and the completion increment previously offered on #3968's source branch. It builds directly on merged #3968; #4892's AnalyzeGraph routing remains separate. No runner changes or dependencies.

Validation on Linux with Ruff 0.17.0:

  • 47 real format/rule/control scenarios plus 22 completion/implicit-check scenarios: 207 native/baseline/fixed executions. Baseline binary is fix(ruff): preserve analyze graph output with global options #4892 head 86547ee0 (its Ruff implementation differs from this PR's 19ece88e base only by graph routing). Twenty format cases previously capped at 2,001 bytes now remain complete. JSON/XML consumers parse 23 output cases.
  • All five shell completions match native stdout exactly. Five Bash forms (plain, isolated, config, color, quiet) pass bash -n; the same five baseline scripts fail syntax checking. Generated scripts are not evaluated.
  • 37 Ruff unit tests and 8 process tests pass, including exact CRLF/argv preservation and an 11 MiB stdout document with separate stderr and exit 1.
  • Full workspace: 5,423 passed, 8 ignored; root/proxy fmt and warnings-denied all-targets clippy pass. The initial sandbox denied a local test port; the complete rerun on this rebased head with loopback access passes.

Other platforms and Ruff versions have not been tested locally.

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

This PR fixes rtk's ruff command wrapper so that explicitly selected output formats, rule documentation, and generate-shell-completion output are passed through completely instead of being truncated or summarized by the existing capture/filter logic. It reuses the existing argument tokenizer to detect --output-format while respecting -- separators and avoiding path/option-value false positives, and adds tests covering completion generation, large documents, and tokenizer edge cases.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4655


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

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

Labels

area:cli bug Something isn't working ruff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk ruff cuts SARIF, JUnit, GitLab, JSON Lines and rule --output-format=json output at the passthrough cap

2 participants