Open gmuecke opened 6 years ago
I added a very basic PoC for this feature https://github.com/devcon5io/mutation-analysis-plugin/tree/standalone-analysis
Build it locally and run it in your project's base directory (where the pom is) via
java -jar target/mutation-analysis-plugin-1.3-SNAPSHOT.jar
You have to have slf4j-api-1.7.6.jar in the same directory. The pitest report must be in target/pit-reports. This produces a issuesReport.json.
Then run the sonar analysis with
mvn sonar:sonar -Dsonar.externalIssuesReportPaths=issuesReport.json
This will import the issues. Each issue only has a message and no rule description. There are no metrics, too.
I haven't tested if the modifications to the jar's manifest affect the compability of the plugin in sonar itself. It's just a PoC atm.
As of now, SonarCloud does not support plugins, therefore no mutation analysis issues can be added to SonarCloud projects.
However, it provides a way to add externally raised issues to the analysis using the Generic Issue Data Format. Although this would not include coverage data and metrics, it's a way to raise issue for surviving mutations.
A very simple approach would be to add an executable java class to the plugin jar (or even make the jar itself executable) that parses the reports as the plugin itself would do and produces a json report with the issues instead of creating the issues via API.
For build pipelines one could use it in these steps (example, not final solution)
*) profile pit activates pitest mutation testing