- SonarQube version: Community Edition Version 7.9.1 (build 27448)
- Scanner version: SonarQube Scanner 22.214.171.1244
What are you trying to achieve?
Detect new code compared with my master branch (git as VCS) so apply the default quality gate over it.
- Coverage on New Code is less than 80.0%
- Duplicated Lines on New Code is greater than 3.0%
- Maintainability Rating on New Code is worse than A
- Reliability Rating on New Code is worse than A
- Security Rating on New Code is worse than A
What have you tried so far to achieve this?
Run analysis only in branches starting in master and setting “New Code Period” as “previous_version”.
Let me put some context before my question:
- We just want to have a quality gate over the new code
- We just want to run an analysis for checking the quality gate on branches starting from master but not in the master branch
- We want to detect new code as the difference between current code in master and the code in the branch where the analysis is executed in the moment the analysis is performed
- Our current sonar-project.properties is something like the following:
- Our current SonarQube configuration for “New code period” is “previous_version”
- New code is currently detected as the difference between the code used for the first analysis we did (couple of weeks ago in a branch when we first integrated it) and the current code (on the branch the analysis is executed)
Based on previous context, looks like all the code that was added after the first run will always be detected as new code and never updated.
How should we configure SonarQube or sonar-project.properties to get the comparison we would like to have?
Thanks in advance.