Add Reviewdog Diagnostic Format #1018
Draft
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.
This PR adds a new output format that can be selected using
--output_formatflag of the linter.The format is described here:
https://github.com/reviewdog/reviewdog/tree/master/proto/rdf
It comes in two versions:
rdjsonis a JSON that contains one object for the whole linting process, with all violations and fixes inside.rdjsonluses JSON Lines to print separate JSON objects for each violation.We use the second one (
rdjsonl).The content is the same, but this format is easier to produce considering the current interface of
ViolationHandlerin Verible.This is done:
There is a class named
RDJsonPrinterwhich implementsViolationHandlerinterface with rule violations and fixes if they exist.The output is interpreted by Reviewdog as expected, which can be seen here:
antmicro/gha-playground#102
Some code related to
ViolationHandlerhas been moved fromverilogtocommon.It seemed like placing
RDJsonPrinterinsideverilogwouldn't be a good idea, so I've used the occasion to refactor these things.This isn't done yet:
The
--output_formatisn't integrated with the--autofixoption correctly.Currently
RDJsonPrinterwill always include autofixes in the output, and will be selected only if you don't select any--autofixoption.Selecting
--autofix=<patch or some other way to fix>results in producing the standard plain text output,so If you'd like to check out this feature, please just use
--output_format=rdjson.Also,
rdjsonis to be renamed tordjsonlso that it's the same name as in Reviewdog.The name of the standard format is currently
plain, and that's the default value.I think
plain,text,plaintextare worth considering.However, I don't think this is the ultimate name and any feedback on this topic would be much appreciated.