Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube Coverage for Branch

Is it possible to get code coverage details for non-master branches in SonarQube? The only two tabs I see for other branches are Issues and Code. I am running the same Gradle JaCoCo/Sonar commands for each branch:

./gradlew report sonarqube -Dsonar.branch.name=${BITBUCKET_BRANCH} -Dsonar.organization=${SONARQUBE_ORG} -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONARQUBE_KEY}

I am using PowerMockito so I need the class instrumentation done by the report task.

We are using Java, Gradle, and JaCoCo with Sonar.

like image 559
Gremash Avatar asked Jul 20 '18 21:07

Gremash


1 Answers

All metrics are calculated and available for Long-lived Branches, but as you've discovered only Issues and Code are available for Short-lived Branches. The plan is to rectify that "soon" (certainly by the 7.x LTS) but there's currently no fixed E.T.A.

Be aware that if you choose to analyze all your branches as long-lived branches, you'll have to manage cleaning them out of SonarQube manually when they're no longer useful. But short-lived branches are cleaned out automatically after a certain number of days with no new analysis.

UPDATE
Code coverage is available on short-lived branches and PRs in 7.4. Duplication will be available in 7.5.

"Real" Quality Gates... "soon".

UPDATE 11 Mar 19
"Real" Quality Gates starting 7.7

UPDATE 16 Dec 19
Short- and Long-lived branches concepts merged into just "Branches" in 8.1, all of which have all metrics and all QG conditions applied.

like image 176
G. Ann - SonarSource Team Avatar answered Nov 15 '22 09:11

G. Ann - SonarSource Team