yoheimuta / protolint

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

Json Report Enhancements #414

Closed profhenry closed 2 months ago

profhenry commented 2 months ago

I would like to propose some enhancements for the JSON report.

  1. add the failure severity
  2. add base directory

Background for adding the base directory: The filename in every failure is relative to the working dir of protoc or the protolint executable. In case you call protoc or protolint multiple times in your build process (e.g. in different maven modules with the maven module as working dir) you will have multiple reports with filenames relatives to different directories. It is difficult to get this properly integrated and displayed in jenkins via warnings-ng-plugin. You could infer the basedir from the report file path but this is a bit itschy. I think adding this to the report is way easier.

Background for altering the JSON report: The warnings-ng-plugin currently parses the plain text report. The plain report currently does not contain the ruleID and the severity. I would suggest to modify the warnings-ng-plugin and parse the JSON report instead of the plain text report. I have created the corresponding issue (https://issues.jenkins.io/browse/JENKINS-73363) and will also prepare a pull request.

profhenry commented 2 months ago

Closing this issue. However integration in jenkins plugin is not finished yet.

profhenry commented 1 month ago

My pull request for JENKINS-73363 was accepted and merged. So the Jenkins warning-ng plugin now also supports parsing of JSON report format (in addition to the plaintext format). Using the JSON format is recommended.

JSON parsing is available in analysis-model-api >= 12.4.0.

Thanks to @uhafner for merging my pull request and releasing 12.4.0 :smiley:

yoheimuta commented 1 month ago

Great work, thank you!