-
-
Notifications
You must be signed in to change notification settings - Fork 47
Support multiple output formats for violation reporting #470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added support for violation reporting in both text and JSON formats by introducing a `Printer` interface and implementing `TextPrinter` and `JsonPrinter` classes. Refactored relevant methods to utilize the new `Printer` system and updated CLI options to allow format selection. Included comprehensive unit tests for the new functionality.
Updated variable names in JsonPrinter to improve readability and better reflect their purpose. This change enhances the maintainability of the code without modifying functionality.
|
It looks good to me, just out of curiosity: is there a particular use case for the json output? |
|
Hi @micheleorselli, for me the scope of the feature is to use with gitlab ci and code quality format supported is json. https://docs.gitlab.com/ci/testing/code_quality/#import-code-quality-results-from-a-cicd-job thank you |
|
Hey @raffaelecarelle, before merging would you mind:
Thanks 🙇 |
Introduces a new `--only-errors` CLI option to suppress non-essential output and display only errors. Refactors `Printer` classes into a dedicated `CLI\Printer` namespace to improve structure and organization.
Hi, I realized that in order to have a valid json, it is necessary to suppress all irrelevant output. So I added another optione --only-errors to do this! As you suggested then, I added an e2e and moved the printer under the CLI folder. Let me know. |
|
my 2 cent: it feels a bit strange having to specify two options in order to get the right output. it would be nice that if I specify |
|
I too initially thought this but preferred to add an option for clarity and greater flexibility. Anyway you tell me, no problem with unifying. |
|
I think that to make the So I agree with you @micheleorselli |
The "only-errors" option was redundant and has been replaced by logic tied to the output format being JSON. This simplifies the code by reducing unnecessary options and aligns behavior directly with the selected format.
|
ok guys, I remove the As you said, this make easier option json to use. ps if other format will added (ex XML), is enought to add it in this condition |
|
thanks @raffaelecarelle! |
Added support for violation reporting in both text and JSON formats by introducing a
Printerinterface and implementingTextPrinterandJsonPrinterclasses. Refactored relevant methods to utilize the newPrintersystem and updated CLI options to allow format selection. Included comprehensive unit tests for the new functionality.