-
Notifications
You must be signed in to change notification settings - Fork 17
Installation
The plugin is installable via the SonarQube Marketplace in the Administration settings.
For a manual installation copy the plugin jar into extensions/plugin
directory and restart the server.
These steps are optional
Under Administration > Configuration > Mutation Analyis you may configure:
-
Active Pitest Java Sensor - turn the sensor for Java files on or off (default:
on
) -
Active Pitest Kotlin Sensor - turn the sensor for Kotlin files on or off (default:
on
) -
Effort Factor: Missing Coverage - configure the factor for calculating tbe total effort to add more coverage (default is
2.0
based on the assumption, that it requires more effort to write a new test than to extend an existing one) -
Effort Factor: Survived Mutant - configure the factor for calculating tbe total effort to kill a survived mutant (default is
1.0
) -
Effort: Kill a mutant - configure the base effort to kill a mutant (default is
5min
). The effective effort is calculated by adding a base effort (7min
) with the effort to kill a mutant (5min
) multiplied by the effort factor for either missing coverage or surviving mutant. The values are based on experience and observations and have to be adjusted to match a projects individual situations. - Enable Experimental Features - Some of the newer features are in experimental state and are disabled by default. These feature are not yet fully tested both in automated tests and practice. Activating these feature might break the analysis but may also provide additional insights into your code.
-
Force Missing Coverage to Zero - If enabled, when there is no mutation information available, either because a class was not mutated or no mutation analysis was run at all, the coverage value is forced to 0. When you define a quality gate based on the mutation score, enabling this switch will fail the quality gate (with 0%) when no mutation analysis is run. (Default is
disabled
) -
Output directory for the PIT reports the subdirectory of a maven project where the pitest report is located (default:
target/pit-reports
)
The effort settings are used to calculate the effort to decrease the technical debt. The default values are arbitrary and are not based on any empirical research.
In order to run a Mutation Analysis a profile with mutation analysis specific rules enable must be used.
You have to configure the rules for Java and Kotlin independently as there are separate profiles for both languages! The steps to do this and the rules are the same for both languages but they are in different rules repositories.
The plugin contains a built-in quality profile, that contains all mutator-specific rules.
If you're using custom profile, you may activate the Mutation Capabilities by adding the mutator rules to the profile:
- Optional: Create a new custom profile or create a copy of an existing profile
- Edit your profile
- Optional set an existing profile as parent (i.e. SonarWay)
- In the rules box, click on "Activate More"
- In the search:
- Select Repository Mutation Analysis
- Select Tag mutation-operator (maybe you have to search for it)
- Click on Bulk change
- Activate in your profile
- Activate your Quality Profile
- Either set it as default
- Or assign it explicitly to your analysis project