Add setting clippy_output_diagnostics to match rustc_output_[...]#3528
Merged
illicitonion merged 1 commit intobazelbuild:mainfrom Aug 25, 2025
Merged
Add setting clippy_output_diagnostics to match rustc_output_[...]#3528illicitonion merged 1 commit intobazelbuild:mainfrom
clippy_output_diagnostics to match rustc_output_[...]#3528illicitonion merged 1 commit intobazelbuild:mainfrom
Conversation
Right now, capturing clippy's diagnostics is in a weird place. `capture_clippy_output` exists, but it has drastically different behavior from `rustc_output_diagnostics` in that it captures the rendered error output and hides it from the terminal, whereas `rustc_output_diagnostics` captures the raw JSON and still prints out the rendered diagnostics. The loss of the JSON is a bit of an issue. With that, the only way to get JSON output from the command-line is to set `clippy_error_format`, which will necessarily *clear the analysis cache* and rebuild all the targets, meaning that you can't get both rendered output *and* JSON output without either rebuilds in-between or relying on custom transitions. This adds the missing equivalent to `rustc_output_diagnostics` in the form of a new option, `clippy_output_diagnostics`. In an ideal world, I'd imagine this would be the *only* option to capture clippy output (since for most intents and purposes, it's strictly a superset of `capture_clippy_output`), but using a separate option and output group preserves backwards compatibility while retaining the parallel naming of `rustc_output_diagnostics` vs `clippy_output_diagnostics`, as well as the output groups `rustc_output` vs `clippy_output`.
6711db1 to
422f5ec
Compare
Contributor
Author
I seem to be constantly finding new ways to fail CI. (should be fixed now.) |
illicitonion
approved these changes
Aug 25, 2025
Collaborator
illicitonion
left a comment
There was a problem hiding this comment.
Makes sense to me - thanks!
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.
Right now, capturing clippy's diagnostics is in a weird place.
capture_clippy_outputexists, but it has drastically different behavior fromrustc_output_diagnosticsin that it captures the rendered error output and hides it from the terminal, whereasrustc_output_diagnosticscaptures the raw JSON and still prints out the rendered diagnostics.The loss of the JSON is a bit of an issue. With that, the only way to get JSON output from the command-line is to set
clippy_error_format, which will necessarily clear the analysis cache and rebuild all the targets, meaning that you can't get both rendered output and JSON output without either rebuilds in-between or relying on custom transitions.This adds the missing equivalent to
rustc_output_diagnosticsin the form of a new option,clippy_output_diagnostics. In an ideal world, I'd imagine this would be the only option to capture clippy output (since for most intents and purposes, it's strictly a superset ofcapture_clippy_output), but using a separate option and output group preserves backwards compatibility while retaining the parallel naming ofrustc_output_diagnosticsvsclippy_output_diagnostics, as well as the output groupsrustc_outputvsclippy_output.