Render concise snapshots in linter tests #19916
Closed
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 is a quick implementation of the idea in #19900 (comment). Especially as we start using new diagnostic features, it seems like a good idea to keep an eye on the
conciseoutput format as well as thefull. This PR just appends a second rendering of the diagnostics in our rule snapshots in theconciseformat. The concise message is typically reused in the other output formats too, so this kind of gives us a bit of coverage for all the output formats.I noticed that some of our concise messages are still quite long. That might be another good class of diagnostic to use new features for. Some explanatory pieces might fit better as sub-diagnostics, now that we're not limited to a single line in the default case.
Adding these lines (and adding a
letbinding foremitter) is the only code change:ruff/crates/ruff_linter/src/test.rs
Lines 371 to 383 in 1fbb88f
Test Plan
Existing snapshots. Again, I clicked through these individually, but very, very quickly