Short Lived Branch / Pull Request code coverage quality gate not working

versions: Sonar Qube Developer Edition Version 7.7 (build 23042), Sonar maven plugin org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398

We evaluated Sonar Qube Developer Edition, and found one blocker issue.

The problem is with the calculation of code coverage and coverage related quality gate for short-lived branches and pull requests.

When we run an analysis for short-lived branch with 54 new lines of code without any coverage, we receive the following stats:

So Coverage is not calculated, and the quality gate is considered as passed (which is wrong).

Exactly same build targeted to sonar cloud works correct (Coverage 0, quality gate failed as expected):
(can’t post image)

We noticed several topics on sonar source forum about similar issues but didn’t find a working solution for SonarQube Developer Edition.

Please provide feedback on what information should I provide to assist in the investigation of this issue.

Hi,

If you go to the Code page for this PR, what do you see?

 
Ann

I see my sample project java files. Coverage column is empty in the file list.

Inside each file coverage is reported as 0% and lines are highlighted with red as uncovered (gate is passed):

Hi,

Thanks for the screenshot. To verify, you are generating your test reports before analysis, right?

 
Thx,
Ann

Yes, we generate junit and jacoco coverage report before calling sonar maven plugin. Also keep in mind that this is jenkins build, and when we are targeting exactly same build to sonar cloud instead of sonar developer edition it works correctly. I can provide verbose maven logs or any other additional information you need. Please post where should I send them.

Hi Michael,

It looks like the problem is that no new lines are being detected as modified in the SLB or P/R.
Could you please post the scanner logs with debug enabled?

Thanks, all for your answers. After careful reading environment settings, i found that server was configured with sonar.scm.disabled=true. This was root cause of issue. After making sonar.scm.disabled=false (default), everything is working as expected.

By the way is " mvn -X -Dsonar.verbose=true … " is the correct way to enable verbose logs for sonar runner?

Ok, thanks for letting us know.

-X is enough to enable verbose logs.