Add report-converter --example flag and EXAMPLE_CMD interface (#4992) - #4996
Open
mmido6039 wants to merge 2 commits into
Open
Add report-converter --example flag and EXAMPLE_CMD interface (#4992)#4996mmido6039 wants to merge 2 commits into
mmido6039 wants to merge 2 commits into
Conversation
bruntib
requested changes
Aug 2, 2026
| </details> | ||
|
|
||
| ## Supported analyzer outputs | ||
| The list below can go out of sync with the actual code. For an always |
Contributor
There was a problem hiding this comment.
I think, the first sentence is unnecessary here.
| [Ruff](https://docs.astral.sh/ruff/) is an extremely fast static analysis | ||
| tool (linter) for `Python` code. | ||
|
|
||
| The recommended way of running Ruff is to generate a `json` output file. |
Contributor
There was a problem hiding this comment.
report-converter accepts only json from rust. So, it is not simply "recommended", but "required" by report-converter.
| # non-empty EXAMPLE_CMD (see AnalyzerResultBase.EXAMPLE_CMD). Existing | ||
| # parsers on this list predate that requirement and should have one added | ||
| # as a follow-up; when a parser is updated, remove it from this list. | ||
| LEGACY_ANALYZERS_WITHOUT_EXAMPLE_CMD = { |
Contributor
There was a problem hiding this comment.
We should include the examples for all analyzer tools in this PR.
In fact, I'm thinking if we could force the existence of EXAMPLE member variable for each analyzer. Would you think, that it could rather be a virtual function? Or maybe the test could fail if any of the supported analyzers don't fill in the EXAMPLE variable.
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
Fixes #4992 by adding a standardized way for
report-converteranalyzers to expose example commands for generating compatible input.What changed
Added the
EXAMPLE_CMDinterface field toAnalyzerResultBase.Added
EXAMPLE_CMDto the Ruff analyzer parser.Added a new
--example <ANALYZER>CLI option toreport-converter.--exampleworks independently of the other required CLI arguments, similarly to--helpand--version.Added documentation for Ruff and the new
--examplefunctionality.Added a documentation note recommending
--exampleas the up-to-date source for analyzer example commands.Added CLI/interface tests covering:
EXAMPLE_CMD.EXAMPLE_CMD.EXAMPLE_CMD.Validation
Manually verified:
report-converter --example ruffprints the expected example command and exits successfully.report-converter --example pylinthandles an analyzer without an example gracefully without crashing.All 5 newly added tests pass.
The broader
report-convertertest suite also contains pre-existing/environment-related failures unrelated to this change, including fixture corruption and package metadata mismatches. These were verified against the unmodified codebase.Motivation
This provides a consistent interface for analyzer-specific example commands and prevents new analyzer parsers from being added without documenting how their compatible input can be generated.