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 adds the ability to output into SARIF from HLint. SARIF is an open interchange format for exchanging results for static analyses. In particular, GitHub uses SARIF for reading results from code scanning tools; this would allow HLint to be used as a code scanning tool in GitHub. The output is complete enough such that output uploaded from a test workflow shows up as a code scanning alert.
The changes adds a
--sarif
flag and a "SARIF" module. E.g., the following will result in the hints being output in SARIF.There are now quite a few output formats that HLint supports. I.e., HLint-native JSON, Code Climate, HTML, Refactor, and now SARIF. I was almost tempted to add a
--format=sarif
flag instead and put the module in "Format.SARIF", but I didn't in order to maintain consistency with existing practice. However, if you would like such a change made, I would be very happy to make it (obviously, I would keep the existing flags alone).This change does not use the sarif package. While it would have not added any new dependencies other than itself, I was a little worried by it having an extra module in the "Data.Aeson" namespace. It is not on Stackage, either, so it would have been a little more work to get it working on stack.
This pull request will resolve #1469.
By raising this pull request, I confirm I am licensing my contribution under all licenses that apply to this project and that I have no patents covering my contribution.