Conversation
clap was rendering the backslashes too:
```
--output-format <OUTPUT_FORMAT>
The format to use for printing diagnostic messages
Possible values:
- full: Print diagnostics verbosely, with context and helpful hints \[default\]
- concise: Print diagnostics concisely, one per line
- gitlab: Print diagnostics in the JSON format expected by GitLab Code Quality reports
```
this is necessary for every JSON-based output format so that the diagnostics render as one JSON array instead of a sequence of one-element arrays
based formats (only gitlab for now)
Contributor
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
ntBre
commented
Aug 29, 2025
Comment on lines
+641
to
+642
| "check_name": "unresolved-reference", | ||
| "description": "unresolved-reference: Name `x` used when not defined", |
Contributor
Author
There was a problem hiding this comment.
One minor note, I know this looks redundant, but GitLab doesn't render the check_name anywhere, so we manually prepend this to the description now (#19881).
Contributor
|
dhruvmanila
approved these changes
Sep 3, 2025
Comment on lines
+325
to
+331
| if is_human_readable { | ||
| writeln!( | ||
| self.printer.stream_for_success_summary(), | ||
| "{}", | ||
| "All checks passed!".green().bold() | ||
| )?; | ||
| } |
Member
There was a problem hiding this comment.
I'm assuming that we do the same thing for Ruff as well?
Contributor
Author
There was a problem hiding this comment.
Yep, pretty similar. Ruff has some Flags for the Printer that toggle showing these messages.
ruff/crates/ruff/src/printer.rs
Lines 85 to 93 in bbfcf6e
second-ed
pushed a commit
to second-ed/ruff
that referenced
this pull request
Sep 9, 2025
## Summary This wires up the GitLab output format moved into `ruff_db` in astral-sh#20117 to the ty CLI. While I was here, I made one unrelated change to the CLI docs. Clap was rendering the escapes around the `\[default\]` brackets for the `full` output, so I just switched those to parentheses: ``` --output-format <OUTPUT_FORMAT> The format to use for printing diagnostic messages Possible values: - full: Print diagnostics verbosely, with context and helpful hints \[default\] - concise: Print diagnostics concisely, one per line - gitlab: Print diagnostics in the JSON format expected by GitLab Code Quality reports ``` ## Test Plan New CLI test, and a manual test with `--config 'terminal.output-format = "gitlab"'` to make sure this works as a configuration option too. I also tried piping the output through jq to make sure it's at least valid JSON
ntBre
added a commit
that referenced
this pull request
Sep 17, 2025
## Summary This PR wires up the GitHub output format moved to `ruff_db` in #20320 to the ty CLI. It's a bit smaller than the GitLab version (#20155) because some of the helpers were already in place, but I did factor out a few `DisplayDiagnosticConfig` constructor calls in Ruff. I also exposed the `GithubRenderer` and a wrapper `DisplayGithubDiagnostics` type because we needed a way to configure the program name displayed in the GitHub diagnostics. This was previously hard-coded to `Ruff`: <img width="675" height="247" alt="image" src="https://github.com/user-attachments/assets/592da860-d2f5-4abd-bc5a-66071d742509" /> Another option would be to drop the program name in the output format, but I think it can be helpful in workflows with multiple programs emitting annotations (such as Ruff and ty!) ## Test Plan New CLI test, and a manual test with `--config 'terminal.output-format = "github"'`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This wires up the GitLab output format moved into
ruff_dbin #20117 to the ty CLI.While I was here, I made one unrelated change to the CLI docs. Clap was rendering the escapes around the
\[default\]brackets for thefulloutput, so I just switched those to parentheses:Test Plan
New CLI test, and a manual test with
--config 'terminal.output-format = "gitlab"'to make sure this works as a configuration option too. I also tried piping the output through jq to make sure it's at least valid JSON