rewrite-gradle-plugin
rewrite-gradle-plugin copied to clipboard
Support output-location and output-format flag to specify the output file/directory in order to integrate other tools
What problem are you trying to solve?
In order to support other tools to extend the output of the result of the rewriteRun task, we should allow for a report to be written as part of these tasks.
Describe the solution you'd like
SARIF support. potentially later we could add additional formats if required.
Additional context
- https://sarifweb.azurewebsites.net/
- https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning
- https://github.com/reviewdog/reviewdog?tab=readme-ov-file#sarif-format
Are you interested in contributing this feature to OpenRewrite?
Yes! will need some pointers on gradle plugin design possibly
Open questions:
- Should we move the responsability for sarif to Result. Similar to diff, one could ask result.sariff(), which would return the jsonString or SarifResult objects.
- Should suggestions include the surrounding context like diff does or should they start at line 1 of change and go till last change?
- If not, what about nonchanged lines in the middle of 2 changed lines. Typically a diff groups these together. If we make suggestion "per line", it might become a lot of comments and a hard to follow suggestion overview.
eg. If the diff is
Do we want to see 1 suggestion including the whiteline in the middle or a suggestion per block (2)?-List<String>oldVariableName=this.lines(); +List<String>list=this.lines(); -oldVariableName.forEach(System.out::println); -System.out.println("List contains " + oldVariableName.size + " items.") +list.forEach(System.out::println); +System.out.println("List contains " + list.size + " items.")
- If not, what about nonchanged lines in the middle of 2 changed lines. Typically a diff groups these together. If we make suggestion "per line", it might become a lot of comments and a hard to follow suggestion overview.
eg. If the diff is