问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/51450583/sonarqube-coverage-for-branch