devcon5io / mutation-analysis-plugin Goto Github PK
View Code? Open in Web Editor NEWPlugin for SonarQube to process mutation analysis results.
License: GNU Lesser General Public License v3.0
Plugin for SonarQube to process mutation analysis results.
License: GNU Lesser General Public License v3.0
Hello,
I'm Alex, Product Manager at Sonar.
SonarQube 10.4 will come with a feature to only download Sonar analyzers and 3rd-party plugins when they are really required by the Scanner. To make this feature work, each analyzer or 3rd-party plugin should declare the list of languages on which they expect to raise issues through a new MANIFEST property called Plugin-RequiredForLanguages.
See https://community.sonarsource.com/t/the-sonarscanners-download-only-required-3rd-party-plugins/108156 for more details.
Regards
According to the page of the plugin: https://www.devcon5.ch/en/products_and_services/products/sonarqube-mutation-plugin/
I was expecting to see the Mutation Analysis tab but it is not there. Is it because the plugin is not supported in 8.4.x?
Hi,
I've got it working with multi-module project on PR branch. Thanks for this!
IME and per docs*, when it comes to enforcement of QG for PR branches, SonarQube uses only New Code conditions. Are there any plans for the plugin to support New Code conditions? Thanks.
*https://docs.sonarsource.com/sonarqube/9.9/analyzing-source-code/pull-request-analysis/
I am using:
I see that pitest generates reports by default path (target/pit-reports). And if I use an absolute path to report-files it will work fine and the mutation-analysis-plugin will send the report about mutations. But it works only for one module. I have two modules with reports files. I have configured all the required properties for mutation-analysis-plugin. I have done next:
But unfortunately, it does not work. And I did not get any results about mutations on SonarQube.
Current issues contain a default description from the MutationOperator definition which is the same for all issues created for the same MutationOperator rule.
Pitest however provides more details on each individual mutation providing a clearer description of what has actually been mutated. This information is available in the mutation.xml in the element.
This element has to be processed and used as violation description. If no such description is present, the default description from the mutation operator definition should be used as fallback.
Log4j core version [2.14.1] used by the plugin is vulnerable to a remote code execution (RCE) attack. Kindly refer below link for description and mitigation.
https://logging.apache.org/log4j/2.x/security.html
Description
Apache Log4j2 versions 2.0-alpha1 through 2.16.0, excluding 2.12.3, did not protect from uncontrolled recursion from self-referential lookups. When the logging configuration uses a non-default Pattern Layout with a Context Lookup (for example, $${ctx:loginId}), attackers with control over Thread Context Map (MDC) input data can craft malicious input data that contains a recursive lookup, resulting in a StackOverflowError that will terminate the process. This is also known as a DOS (Denial of Service) attack.
This is to upgrade the log4j core version to a non-vulnerable version [ Log4j 2.3.1 (for Java 6), 2.12.3 (for Java 7), or 2.17.0 (for Java 8 and later)] as shown in mitigation steps on above page.
Note: Pull request $65 already exists to bump up the log4j version and is still open
References:
https://logging.apache.org/log4j/2.x/security.html
https://nvd.nist.gov/vuln/detail/CVE-2021-45105
Thanks.
Hello,
I get the following warning during the sonarqube analysis, but 7 rules are activated in my profile
[WARNING] /!\ At least one Mutation Analysis rule needs to be activated the current profile.
thanks,
Mark
Fix all non-TODO CodeSmells from the sonarqube analysis
https://sonarcloud.io/project/issues?id=ch.devcon5.sonar%3Amutation-analysis-plugin&resolved=false&types=CODE_SMELL
Hi,
Thanks for the plugin , we have bee using it for sometime and has helped the teams to understand the Unite Test gaps.
We have recently updated SonarQube from 6.7 to 7.9 LTS . The Mutation plugin is not generating the report on it , even though site says its compatible.
Environment:
SonarQube Version : Version 7.9.5 (build 38598) Edition --> DataCenter
PITest Plugin Version : 1.6.3
Junit : 5
Mutation analysis Plugin Version : 1.5
While analyzing the code in Local SonarQube setup , the Mutation Analysis report is available for the same version as mentioned, but while running the analysis through Jenkins , its somehow missing , even though I can see the exact same logs on local and Jenkins. Is there any additional property(ies) need to be set for the report generation?
Plugin Logs :
[INFO] 09:27:38.830 Sensor Mutation Analysis [mutationanalysis]
[DEBUG] 09:27:38.830 Enabled Languages for Pitest: [java, kotlin]
[DEBUG] 09:27:38.830 Enabled Languages for Pitest: [java, kotlin]
[INFO] 09:27:38.830 Pitest Sensor [java, kotlin] running on [key=com.mycompany.sample:simpleinterest-microservice] in I:\Dev\ssh-repo\simpleinterest-microservice
[DEBUG] 09:27:38.831 Reading mutants
[DEBUG] 09:27:38.832 Searching pit reports in I:\Dev\ssh-repo\simpleinterest-microservice\target\pit-reports
[DEBUG] 09:27:38.904 Found mutant Mutant [sourceFile=SimpleInterestService.java, mutatedClass=com.mycompany.sample.service.SimpleInterestService, mutatedMethod=simpleInterestCalculation, methodDescription=(Lcom/mycompany/sample/domain/SimpleInterestDTO;)Ljava/lang/Double;, lineNumber=16, state=KILLED, mutationOperator=Empty Object Return Vals Mutator, numberOfTestsRun=1, killingTest=com.mycompany.sample.controller.SimpleInterestControllerIntegrationTest.simpleInterestCalculationTest(), description=replaced Double return value with 0 for com/mycompany/sample/service/SimpleInterestService::simpleInterestCalculation]
[DEBUG] 09:27:38.906 Found mutant Mutant [sourceFile=SimpleInterestService.java, mutatedClass=com.mycompany.sample.service.SimpleInterestService, mutatedMethod=simpleInterestCalculation, methodDescription=(Lcom/mycompany/sample/domain/SimpleInterestDTO;)Ljava/lang/Double;, lineNumber=16, state=KILLED, mutationOperator=Math Mutator, numberOfTestsRun=1, killingTest=com.mycompany.sample.controller.SimpleInterestControllerIntegrationTest.simpleInterestCalculationTest(), description=Replaced double multiplication with division]
[DEBUG] 09:27:38.907 Found mutant Mutant [sourceFile=SimpleInterestService.java, mutatedClass=com.mycompany.sample.service.SimpleInterestService, mutatedMethod=simpleInterestCalculation, methodDescription=(Lcom/mycompany/sample/domain/SimpleInterestDTO;)Ljava/lang/Double;, lineNumber=16, state=KILLED, mutationOperator=Math Mutator, numberOfTestsRun=1, killingTest=com.mycompany.sample.controller.SimpleInterestControllerIntegrationTest.simpleInterestCalculationTest(), description=Replaced double multiplication with division]
[DEBUG] 09:27:38.908 Found mutant Mutant [sourceFile=SimpleInterestService.java, mutatedClass=com.mycompany.sample.service.SimpleInterestService, mutatedMethod=simpleInterestCalculation, methodDescription=(Lcom/mycompany/sample/domain/SimpleInterestDTO;)Ljava/lang/Double;, lineNumber=16, state=KILLED, mutationOperator=Math Mutator, numberOfTestsRun=1, killingTest=com.mycompany.sample.controller.SimpleInterestControllerIntegrationTest.simpleInterestCalculationTest(), description=Replaced double division with multiplication]
[DEBUG] 09:27:38.910 Found mutant Mutant [sourceFile=SimpleInterestService.java, mutatedClass=com.mycompany.sample.service.SimpleInterestService, mutatedMethod=simpleInterestCalculation, methodDescription=(Lcom/mycompany/sample/domain/SimpleInterestDTO;)Ljava/lang/Double;, lineNumber=12, state=KILLED, mutationOperator=Negate Conditionals Mutator, numberOfTestsRun=1, killingTest=com.mycompany.sample.controller.SimpleInterestControllerIntegrationTest.simpleInterestCalculationTest(), description=negated conditional]
[DEBUG] 09:27:38.911 Found mutant Mutant [sourceFile=SimpleInterestController.java, mutatedClass=com.mycompany.sample.controller.SimpleInterestController, mutatedMethod=calculateSimpleInterest, methodDescription=(Lcom/mycompany/sample/domain/SimpleInterestDTO;)Ljava/lang/Double;, lineNumber=36, state=KILLED, mutationOperator=Empty Object Return Vals Mutator, numberOfTestsRun=1, killingTest=com.mycompany.sample.controller.SimpleInterestControllerTest.Simple Interest Test Is good, description=replaced Double return value with 0 for com/mycompany/sample/controller/SimpleInterestController::calculateSimpleInterest]
[DEBUG] 09:27:38.913 Found mutant Mutant [sourceFile=SimpleInterestController.java, mutatedClass=com.mycompany.sample.controller.SimpleInterestController, mutatedMethod=calculateSimpleInterest, methodDescription=(Lcom/mycompany/sample/domain/SimpleInterestDTO;)Ljava/lang/Double;, lineNumber=32, state=KILLED, mutationOperator=Negate Conditionals Mutator, numberOfTestsRun=1, killingTest=com.mycompany.sample.controller.SimpleInterestControllerTest.Simple Interest Test Is good, description=negated conditional]
[DEBUG] 09:27:38.914 Found mutant Mutant [sourceFile=SimpleInterestController.java, mutatedClass=com.mycompany.sample.controller.SimpleInterestController, mutatedMethod=hello, methodDescription=(Ljava/lang/String;)Ljava/lang/String;, lineNumber=43, state=KILLED, mutationOperator=Empty Object Return Vals Mutator, numberOfTestsRun=2, killingTest=com.mycompany.sample.controller.SimpleInterestControllerIntegrationTest.getHelloTest(), description=replaced return value with "" for com/mycompany/sample/controller/SimpleInterestController::hello]
[DEBUG] 09:27:38.916 Found mutant Mutant [sourceFile=SimpleInterestDTO.java, mutatedClass=com.mycompany.sample.domain.SimpleInterestDTO, mutatedMethod=getPrincipal, methodDescription=()D, lineNumber=12, state=KILLED, mutationOperator=Primitive Returns Mutator, numberOfTestsRun=1, killingTest=com.mycompany.sample.controller.SimpleInterestControllerIntegrationTest.simpleInterestCalculationTest(), description=replaced double return with 0.0d for com/mycompany/sample/domain/SimpleInterestDTO::getPrincipal]
[DEBUG] 09:27:38.918 Found mutant Mutant [sourceFile=SimpleInterestDTO.java, mutatedClass=com.mycompany.sample.domain.SimpleInterestDTO, mutatedMethod=getRate, methodDescription=()F, lineNumber=20, state=KILLED, mutationOperator=Primitive Returns Mutator, numberOfTestsRun=1, killingTest=com.mycompany.sample.controller.SimpleInterestControllerIntegrationTest.simpleInterestCalculationTest(), description=replaced float return with 0.0f for com/mycompany/sample/domain/SimpleInterestDTO::getRate]
[DEBUG] 09:27:38.919 Found mutant Mutant [sourceFile=SimpleInterestDTO.java, mutatedClass=com.mycompany.sample.domain.SimpleInterestDTO, mutatedMethod=getYears, methodDescription=()I, lineNumber=28, state=KILLED, mutationOperator=Primitive Returns Mutator, numberOfTestsRun=1, killingTest=com.mycompany.sample.controller.SimpleInterestControllerIntegrationTest.simpleInterestCalculationTest(), description=replaced int return with 0 for com/mycompany/sample/domain/SimpleInterestDTO::getYears]
[DEBUG] 09:27:38.921 collecting metrics
[DEBUG] 09:27:38.925 Enabled Languages for Pitest: [java, kotlin]
[DEBUG] 09:27:38.925 applying java rules
[DEBUG] 09:27:38.927 applying kotlin rules
[WARNING] 09:27:38.927 /!\ At least one Mutation Analysis rule needs to be activated the current profile.
[DEBUG] 09:27:38.927 saving metrics
[DEBUG] 09:27:38.933 Saving resource metrics for src/main/java/com/mycompany/sample/controller/SimpleInterestController.java
[DEBUG] 09:27:38.949 Saving resource metrics for src/main/java/com/mycompany/sample/service/SimpleInterestService.java
[DEBUG] 09:27:38.956 Saving resource metrics for src/main/java/com/mycompany/sample/domain/SimpleInterestDTO.java
[DEBUG] 09:27:38.965 Experimental features disabled
[DEBUG] 09:27:38.965 Done
[INFO] 09:27:38.965 Sensor Mutation Analysis [mutationanalysis] (done) | time=135ms
EDIT Update : when I appended &metric=dc5_mutationAnalysis_mutations_detected
in the WebURL on Server , I can see the BUGS which are Alive Mutants.
"Mutation Analysis" Link on "Measures" Page is not showing.
Can you help?
Thanks in advance
Regards
Milind
Compute Number of potentially uncovered bugs, based on kLoC and Mutation Coverage.
Based on the assumption that
Threshold values and ratios should be coverable.
These metrics should give an indication of scale of number of bugs that are potentially hidden in the codebase and are left for test approaches other than unit test.
see also
In a future extension, the potential bugs could be comapared with actual bugs (i.e. from Jira)
do you think about doing analysis with stryker?
Evaluate the possibilities of processing the metric "numberOfTestsRun" per Mutation/target Class.
High numbers might be an indication that the UnitTest lack cohesiveness with that Unit so that other tests "have to jump in". Low numbers indicate high cohesiveness.
Consider to have absolute numbers (sum of numberOfTestsRun per class) or relative numbers (testRuns per mutation, testRuns per Unit) or all of them.
see #9 (comment)
At the moment, the report folder is taken from the plugin configuration in sonarqube.
Maybe it's possible to use the report folder configured in the maven plugin configuration of pitest.
The goal of this issue is to explore the feasibility of this feature and if such information could possibly be taken from the maven execution environment.
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
Hi,
We have recently upgraded SonarQube from 8.2 to 9.1 .
The Mutation plugin is failing when analysing pit reports
Environment:
SonarQube Version : Community Edition, Version 9.1 (build 47736)
PITest Plugin Version : 1.6.4
pitest-junit5-plugin Version: 0.12
Mutation analysis Plugin Version : 1.5
JDK16
realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/home/user/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.0.2155/sonar-maven-plugin-3.9.0.2155.jar
urls[1] = file:/home/user/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
urls[2] = file:/home/user/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
urls[3] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
urls[4] = file:/home/user/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.jar
urls[5] = file:/home/user/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/home/user/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.0.2155/sonar-maven-plugin-3.9.0.2155.jar
urls[1] = file:/home/user/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
urls[2] = file:/home/user/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
urls[3] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
urls[4] = file:/home/user/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.jar
urls[5] = file:/home/user/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/home/user/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.0.2155/sonar-maven-plugin-3.9.0.2155.jar
urls[1] = file:/home/user/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
urls[2] = file:/home/user/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
urls[3] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
urls[4] = file:/home/user/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.jar
urls[5] = file:/home/user/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:169)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.NoClassDefFoundError: com/ctc/wstx/exc/WstxParsingException
at ch.devcon5.sonar.plugins.mutationanalysis.report.Reports.readMutants (Reports.java:78)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.ReportCollector.collectLocalMutants (ReportCollector.java:108)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.PitestSensor.execute (PitestSensor.java:142)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse (AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute (ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1 (ModuleSensorsExecutor.java:59)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy (ModuleSensorsExecutor.java:77)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute (ModuleSensorsExecutor.java:59)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart (ModuleScanContainer.java:79)
at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:123)
at org.sonar.scanner.scan.ProjectScanContainer.scan (ProjectScanContainer.java:382)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively (ProjectScanContainer.java:378)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart (ProjectScanContainer.java:347)
at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:123)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart (GlobalContainer.java:136)
at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:123)
at org.sonar.batch.bootstrapper.Batch.doExecute (Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute (Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute (BatchIsolatedLauncher.java:46)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke (IsolatedLauncherProxy.java:60)
at jdk.proxy3.$Proxy25.execute (Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute (EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute (EmbeddedScanner.java:138)
at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute (ScannerBootstrapper.java:65)
at org.sonarsource.scanner.maven.SonarQubeMojo.execute (SonarQubeMojo.java:108)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.ClassNotFoundException: com.ctc.wstx.exc.WstxParsingException
at org.sonar.classloader.ParentFirstStrategy.loadClass (ParentFirstStrategy.java:39)
at org.sonar.classloader.ClassRealm.loadClass (ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass (ClassRealm.java:76)
at ch.devcon5.sonar.plugins.mutationanalysis.report.Reports.readMutants (Reports.java:78)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.ReportCollector.collectLocalMutants (ReportCollector.java:108)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.PitestSensor.execute (PitestSensor.java:142)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse (AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute (ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1 (ModuleSensorsExecutor.java:59)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy (ModuleSensorsExecutor.java:77)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute (ModuleSensorsExecutor.java:59)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart (ModuleScanContainer.java:79)
at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:123)
at org.sonar.scanner.scan.ProjectScanContainer.scan (ProjectScanContainer.java:382)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively (ProjectScanContainer.java:378)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart (ProjectScanContainer.java:347)
at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:123)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart (GlobalContainer.java:136)
at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:123)
at org.sonar.batch.bootstrapper.Batch.doExecute (Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute (Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute (BatchIsolatedLauncher.java:46)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke (IsolatedLauncherProxy.java:60)
at jdk.proxy3.$Proxy25.execute (Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute (EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute (EmbeddedScanner.java:138)
at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute (ScannerBootstrapper.java:65)
at org.sonarsource.scanner.maven.SonarQubeMojo.execute (SonarQubeMojo.java:108)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
Can you help?
Thanks in advance
Regards
Pierre
Hello,
I am currently using SonarQube 8.9 LTS enterprise edition.
With this the latest SonarQube mutation analysis plugin that comes with it, downloaded from SonarQube market place.
Reproducible 100%, getting the warning
[WARNING] /!\ At least one Mutation Analysis rule needs to be activated the current profile.
This is similar to issue reported:
#42
But for the newest version.
May I ask what is the root cause please?
Thank you
Currently, if no mutation information is present (i.e. no pitest report present), no metrics are generated.
Because of this, quality gates as well as global measures in multi-module projects can easily be tricked by disabling pitest execution, resulting in passed quality gates as well as better overall metrics.
In order to improve this, no mutation information should be treated as 0 coverage information so that Quality Gates can define conditions even on projects without mutation analysis.
This behavior should be configurable (omit or 0) so it can be set globally as well as on a plugin basis.
If no mutation information is available, only Mutation Coverage should be computed (with 0%), all other metrics should be omitted, so it become easily detectable whether Mutation Analysis is missing (only coverage) or not (full metrics provided)
See also this StackOverflow request: https://stackoverflow.com/questions/51259681/quality-gate-on-pitest-mutations-is-not-triggerd-when-project-does-not-run-pites
Treating missing information as 0-coverage is somewhat consistent with the other coverage metrics, see here https://stackoverflow.com/questions/39529432/sonarqube-projects-pass-quality-gate-when-there-is-no-data
Stryker-Mutator is a popular tool for running mutation tests in JavaScript projects. The results should be processed by the plugin too - an additional sensor would be sensible.
Stryker-Mutator already provides a dedicated sonar-stryker-plugin that is ~1 year old and is based on the SonarQube 5.6 API which contains 2 rules (survivor, no coverage) and thus creates only two types of issues. It contains no metrics.
Adding Stryker support would provide the same level of detail and the additional metrics for JavaScript projects as for Java projects, probably some new mutator-specific rules for Stryker have to be added too.
All specific mutator rules are of type "Bug", while the non-specific rules (i.e. "Surviving mutant", defined in the rules.xml) have no type set defaulting to "Code Smell", so both rule sets are inconsitent, especially when used together.
The non-specific rules should be of type "bug".
Hello Gerald, (@gmuecke )
I have been work with your great plugin in my locally hosted SonarQube instance for a few weeks and found it quite useful.
I have now asked my admins to consider installing this plugin on our company's central SonarQube cluster and they came back with a few concerns. Since I am no expert and only briefly looked through the plugin's source code, I was wondering if you could help me out with the following concerns/questions.
Note:
info
-type logging regardless of server/project settingsI have already tested some of these concern and noticed the following:
Hey,
for some projects I try to integrate the mutation analysis plugin but I get the following error
251 is not a valid line for pointer. File some/directory/file.kt has 243 line(s)
Sonarqube: 7.9.4
Gradle: 6.5
JVM: 1.8.0.251
Pitest: 1.4
Mutation Analysis Plugin: 1.5
I tried several things to get rid of the error and found out, that deactivating some specific rules won't end in this error.
For some projects it were the following rules:
Here the Stacktrace:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sonarqube'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:96)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:65)
at org.gradle.api.internal.tasks.execution.ActionEventFiringTaskExecuter.execute(ActionEventFiringTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.TimeoutTaskExecuter.execute(TimeoutTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.SnapshotAfterExecutionTaskExecuter.execute(SnapshotAfterExecutionTaskExecuter.java:38)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:49)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:61)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:55)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:49)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:44)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:337)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:325)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:318)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:304)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.IllegalArgumentException: 251 is not a valid line for pointer. File some/directory/file.kt has 243 line(s)
at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:336)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:272)
at org.sonar.api.batch.fs.internal.DefaultInputFile.selectLine(DefaultInputFile.java:295)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.applyMutantRule(RulesProcessor.java:205)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.applyRule(RulesProcessor.java:117)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.applyRules(RulesProcessor.java:99)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.lambda$processRules$3(RulesProcessor.java:83)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.processRules(RulesProcessor.java:83)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.PitestSensor.lambda$execute$1(PitestSensor.java:149)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.PitestSensor.execute(PitestSensor.java:147)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy251.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarqube.gradle.SonarQubeTask.run(SonarQubeTask.java:100)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:704)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:671)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:117)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:106)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:85)
... 35 more
When fetching the Sonar data into Atlassian's Stash, the full metric name is displayed, rather than a friendly name like Mutation Coverage.
Most probably there is something misconfigured here
Pitests counts the number of tests executed to kill a muation. This metric should also be collected and exposed in SonarQube. A high test execution count might be an indicator of a "by-catch" / non-specific test.
Method 'findMostRecentReport' in ReportFinder find only xmls, that include in target/pit-reports folder. But PiTest generate subdirectory such as "201807291717", or "201807291718" where include report (mutations.xml, *.html). For that reason be pretty if it will recursively find mutations.xml in subfolder. Use ... extends SimpleFileVisitor Give me 30 minutes, i will make PR.
I have upgrade my SonarQube to 7.6 and now I have an error when I scan my project:
ERROR: Error during SonarQube Scanner execution
ERROR: ch.devcon5.sonar.plugins.mutationanalysis.sensors.PitestSensor has unsatisfied dependency 'class org.sonar.api.profiles.RulesProfile' for constructor 'public ch.devcon5.sonar.plugins.mutationanalysis.sensors.PitestSensor(org.sonar.api.config.Configuration,org.sonar.api.profiles.RulesProfile,org.sonar.api.batch.fs.FileSystem)' from org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@55b62629:45<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@6c2c1385:353<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@585ac855:39<|
We are using the standalone analysis feature/branch of the plugin. Which means I have to compile it for myself, in an environment where the java version is 11. ( https://github.com/kode-konveyor/toolchain )
This functionality is a part of a standardized toolchain currently used by 7 other projects.
Our policy views having local changes to other people's code as a temporary workaround: we are willing to do whatever is needed to get the change upstream, and we fork the project as last resort.
Java 8 is being deprecated, in extended support right now. "Java SE 8 has gone through the End of Public Updates process for legacy releases. Oracle will continue to provide free public updates and auto updates of Java SE 8 from Oracle at java.com, until at least the end of December 2020 for Personal, Development and other Users." https://www.oracle.com/technetwork/java/java-se-support-roadmap.html
Java 11 is the current LTS, with premier support until September 2023 and extended support until September 2026.
In the long run support for java 11 will be needed anyway.
The pull request addressing this issue is at #34
which versions are you using: 8.9.1 LTS
what are you trying to achieve: Making sure the quality of unit tests
what have you tried so far to achieve this: Use mutation pitests
I am checking on a Java code to see if unit tests are good and get a handle of the current situation in regards on unit tests.
I took someone else´s quality profile rules for Java and added mutation pitest rules.
Mutation tests are reporting quite poor unit tests (50% strength of unit tests).
When I try to import the pitests I get a bunch of warning saying:
WARN: Found unknown mutation operator: org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator
or
WARN: Found unknown mutation operator: WARN: Found unknown mutation operator: org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator
and many similar warnings.
I run the scanner like this:
“C:\software\PackSonar\sonar-scanner-4.6.0.2311-windows\bin\sonar-scanner.bat” -D"sonar.projectKey=ProjectName" -D"sonar.sources=." -D"sonar.host.url=http://localhost:9000" -D"sonar.login=fffffffffffffffffffffffffffffffffffffffffffff"
-D"sonar.dependencyCheck.htmlReportPath=.\ProjectName\dependency-check-report.html" -D"sonar.dependencyCheck.xmlReportPath=.\ProjectName\dependency-check-report.xml" -D"sonar.coverage.jacoco.xmlReportPaths=.\ProjectName\jacoco.xml" -D"dc5.mutationAnalysis.pitest.sensor.reports.directory=.\ProjectName\target\pit-reports\202110281422"
I am wondering if there is any issue that I should be aware and if so, how to avoid it
When Sonarqube makes a new analysis it call's to our webhook with the analysis results. The problem is in the test kill ratio information, sonar send a body without value.
Example:
{
"metric": "dc5_mutationAnalysis_mutations_testkill_ratio",
"operator": "GREATER_THAN",
"status": "NO_VALUE",
"errorThreshold": "0"
}
Mutation analisys is being done correctly:
Sonarqube version: 8.9.3
Mutation analysis plugin version: 1.5
In my opinion, mutation testing is not primarily aimed at detecting issues in the production code, but rather to gauge the quality of the unit tests. Therefore, I feel that classifying mutation test issues as Bugs
sends the wrong message.
There might well be bugs lurking there, since some condition is untested, but a mutation test issue simply says that some part of the code is insufficiently tested. Without any corroborating evidence, I think it is premature to claim that there is anything wrong with the production code (i.e. a bug).
The way to fix mutation test issues is usually to modify or add unit tests, not change the production code. (Looking at mutation test issues may give insights that inspire redesign of the production code, but that is probably not the most common case, and even so, that process would probably still start with adding unit tests before refactoring).
I would prefer mutation test issues to be classified as Code Smells
, but I realise that this is project dependent, so I propose that the issue type should be configurable [Bugs|Vulnerabilities|Code Smells]
, preferably on mutation operator level in the same way severity is, with Code Smells
being the default option.
I can execute pitest using gradle and pitest gradle plugin successfully. When I attempt to send to sonarqube I get
Line 44 is out of range in the file src/main/kotlin/com//Runner.kt (lines: 43)
I traced this to a Jacoco issue. To resolve this, the version should be updated to 0.8.3 in the pom.xml
I am running against sonarqube 7.6 with the latest version of the sonar pitest plugin
Current Version only supports mutation reports for .java files. The https://github.com/VinodAnandan/sonar-pitest plugin alsow provides kotlin support.
As the results produced by pitest are the same, the change should be rather limited, as the plugin analysis scope only has to be extended to include kotlin files (.kt) too.
Hello,
We are trying to publish the mutation analysis results in SonarQube but it not working as expected. Below is the project details,
SonarQube Version - 9.9 LTS
Mutation Plugin Version - 1.7
Properties & Config Added: dc5.mutationAnalysis.pitest.sensor.reports.directory=build/reports/pitest
dc5.mutationAnalysis.pitest.java.sensor.enabled=true
pitest {
junit5PluginVersion = '1.0.0' //or 0.15 for PIT <1.9.0
useClasspathFile = true
targetClasses = ['***']
threads = (Runtime.getRuntime().availableProcessors() * 0.5).intValue()
outputFormats = ['XML', 'HTML']
mutators = ['ALL']
timestampedReports = false
failWhenNoMutations = false
enableDefaultIncrementalAnalysis = true
}
Log Results:
16:08:17.264 DEBUG: Reading mutants
16:08:17.264 DEBUG: Searching pit reports in /workspace/source/build/reports/pitest
16:08:17.265 DEBUG: No report /workspace/source/build/reports/pitest found
16:08:17.265 DEBUG: collecting metrics
16:08:17.265 DEBUG: Enabled Languages for Pitest: [java, kotlin]
16:08:17.265 DEBUG: applying java rules
16:08:17.267 DEBUG: applying kotlin rules
Note: Mutation Analysis report is getting generated in local but the results are not getting reflected in sonar dashboard.
Please guide me in what I am missing.
Thank you!
We upgraded from Sonar Enterprise 7.9 to 8.9 this week and are now seeing an issue with the mutation plugin. The mutation metric appears under the "measures" tab, but it always shows 0% despite there clearly being mutation reports under the pit-test directory. It appears that the plugin is having an issue resolving the top level path for the build directory.
[INFO] 19:52:42.720 Pitest Sensor [java, kotlin] running on [key=com.jbhunt.finance:ws_finance_billing_axs_tasks] in /dockeragents/sw/ADOAgents/ADOAgent3/_work/1315/s
[DEBUG] 19:52:42.721 Reading mutants
[DEBUG] 19:52:42.724 Searching project root for /dockeragents/sw/ADOAgents/ADOAgent3/_work/1315/s
[INFO] 19:52:42.776 Could not determine project root of /dockeragents/sw/ADOAgents/ADOAgent3/_work/1315/s from parent
[DEBUG] 19:52:42.781 Could not resolve module paths for pom /dockeragents/sw/ADOAgents/ADOAgent3/_work/1315/pom.xml
java.nio.file.NoSuchFileException: /dockeragents/sw/ADOAgents/ADOAgent3/_work/1315/pom.xml
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
The current support for Maven multi-module projects is very basic. There are several TODOs in the code that need to be addressed:
Hello Mutation Analysis Team,
Just wanted to say thanks for this very cool project, mutation tests are awesome!
I have a small issue, when running mutation tests with JUNIT 5 + pitest + SonarQube, and would like to raise it here.
Setup:
SonarQube 9.1 with the this analysis plugin installed.
And in Maven:
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.9.1.2184</version>
<dependencies>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.4.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.7.4</version>
<configuration>
<withHistory>true</withHistory>
<threads>16</threads>
<outputFormats>
<param>XML</param>
<param>HTML</param>
</outputFormats>
<mutators>
<mutator>CONDITIONALS_BOUNDARY</mutator>
<mutator>INCREMENTS</mutator>
<mutator>INVERT_NEGS</mutator>
<mutator>MATH</mutator>
<mutator>NEGATE_CONDITIONALS</mutator>
<mutator>EMPTY_RETURNS</mutator>
<mutator>FALSE_RETURNS</mutator>
<mutator>TRUE_RETURNS</mutator>
<mutator>PRIMITIVE_RETURNS</mutator>
<mutator>REMOVE_INCREMENTS</mutator>
<mutator>EXPERIMENTAL_BIG_INTEGER</mutator>
<mutator>EXPERIMENTAL_MEMBER_VARIABLE</mutator>
<mutator>EXPERIMENTAL_SWITCH</mutator>
<mutator>CRCR1</mutator>
<mutator>CRCR2</mutator>
<mutator>CRCR3</mutator>
<mutator>CRCR4</mutator>
<mutator>CRCR5</mutator>
<mutator>CRCR6</mutator>
<mutator>ROR1</mutator>
<mutator>ROR2</mutator>
<mutator>ROR3</mutator>
<mutator>ROR4</mutator>
<mutator>ROR5</mutator>
</mutators>
</configuration>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>0.15</version>
</dependency>
</dependencies>
</plugin>
Note, I add manually the mutators I am interested in instead of any default.
I am referring to this list for the actual content:
http://pitest.org/quickstart/mutators/
Unfortunately, when I am running tests, I am always observing WARNING such as:
[WARNING] Found unknown mutation operator: org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator
[WARNING] Found unknown mutation operator: org.pitest.mutationtest.engine.gregor.mutators.rv.UOI1Mutator
[WARNING] Found unknown mutation operator: org.pitest.mutationtest.engine.gregor.mutators.rv.UOI2Mutator
[WARNING] Found unknown mutation operator: org.pitest.mutationtest.engine.gregor.mutators.rv.UOI3Mutator
[WARNING] Found unknown mutation operator: org.pitest.mutationtest.engine.gregor.mutators.rv.UOI4Mutator
I am having a hard time understanding, since those mutators should be supported by PITEST.
May I ask what is the issue and how to address this please?
Thank you
I'm using: pitest 1.4 + SonarQube latest + mutation-analysis-plugin latest = didn't work.
It's normal? Just to know.
I got this error:
Error during SonarQube Scanner execution
java.lang.IllegalArgumentException: 0 is not a valid line for a file
at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:335)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:272)
at org.sonar.api.batch.fs.internal.DefaultInputFile.selectLine(DefaultInputFile.java:295)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.applyMutantRule(RulesProcessor.java:205)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.applyRule(RulesProcessor.java:117)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.applyRules(RulesProcessor.java:99)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.lambda$processRules$3(RulesProcessor.java:83)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.processRules(RulesProcessor.java:83)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.PitestSensor.lambda$execute$1(PitestSensor.java:149)
at java.base/java.util.ArrayList.forEach(Unknown Source)
at ch.devcon5.sonar.plugins.mutationanalysis.sensors.PitestSensor.execute(PitestSensor.java:147)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:387)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:383)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:346)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.