yoheimuta / protolint

A pluggable linter and fixer to enforce Protocol Buffer style and conventions.
MIT License
576 stars 51 forks source link

[Reporters] Add ability to use multiple reporters #336

Closed carstencodes closed 1 year ago

carstencodes commented 1 year ago

In CI/CD Scenarios or in local development, it is quite the case, that a linter must produce different results.

CI/CD

In CI/CD Pipelines (like github actions, gitlab or Azure DevOps), a console logger using a proprietary format is used. On the other hand, the connected code quality system like Sonarqube, Github CodeQL etc. expects a certain file.

Local IDE

IDEs support both - using a result file and command line output to parse using a matcher expression (cf VsCode).

Conclusion

It would be a good feature to add support for a second (or maybe more) reporters, that can write their output to files.

e.g:

$ protolint -report console -add-report sarif=$(pwd)/out/result.sarif

What do you think? I would actually like to give it a try and help with a contribution.

yoheimuta commented 1 year ago

@carstencodes Thank you for your suggestion! I think it makes sense 👍

carstencodes commented 1 year ago

Prototype currently available at https://github.com/carstencodes/protolint/commit/d568455380c3c5bf1b031c01d1003d26e18e985c

carstencodes commented 1 year ago

Actually replaced -add-report sarif=${pwd}/out.sarif with -add-reporter sarif:${pwd}/out.sarif, hence flags might also use assign characters.

carstencodes commented 1 year ago

Currently working on tests ...