Hello there
I am currently evaluating SonarQube’s Developer Edition. We are thinking about switching to this license, because we want get analysis data of our branches, wich is not possible with the Community Edition.
I am currently working with a test instance and an evaluation license. I am facing the following problem:
Somehow, code coverage does not break our quality gate on branches.
Our quality gate is configured like this:
- Condition Coverage on New Code is less than 80.0%
- Coverage on New Code is less than 70.0%
- Maintainability Raiting on New Code is worse than B
- Reliability Raiting on New Code is worse than B
- Security Rating on New Code is worse than A
I’ve added some code to a project that messes up the code coverage and built the project locally
mvn clean install sonar:sonar -Dsonar.branch.name=testBranch -Dsonar.branch.target=master
This resulted in a branch showing up on my SonarQube server for the project. As you can see in the picture below, the quality gate passed. But the coverage metric seems to be broken! Instead of a numeric value I am getting a “-”. But, and this confuses me a little bit, SonarQube is able to calculate an estimated code coverage after the merge of the branch. So coverage data seems to be there, but is somehow not used when checking the quality gate for branches.
To verify that my code actually breaks the quality gate, I built the project with this command
mvn clean install sonar:sonar
which makes sonar assume that the analysis is executed for the master branch / the branch was merged to master. This leads to a broken quality gate on SonarQube’s master branch panel of the project.
Has anyone faced the same issue?
I don’t exactly know where to start with this, does the plugin for code analysis (jacoco) not work properly / is it configured wrong, am I executing the maven build with wrong parameters, is there a configuration on SonarQube that I need to set?
By the way, the quality gate of the branch brakes if Reliability is worse than A, so it seems like the problem is only the code coverage.
Tanks in advance!
Additional information:
- SonarQube Version: 7.7.0.23042
- Code that gets analyzed: Java / Spring-Boot 2
- Plugin for analysis: jacoco