We have a project branch from our develop branch (default branch in Bitbucket). That project branch is somewhat long-lived, and has low coverage, e.g. 50%. We created a feature branch from that project branch, and made one small change in a class with good coverage. The pipeline ran on the feature branch, and the “new code” coverage is reported at 30%. When we click on the “More details on SonarCloud”, it opens SonarCloud with the source feature branch compared against develop, not the project branch, with the same low coverage. There’s no way to see the feature branch compared with the real base branch in this case.
I am using the org.sonarcube and jacoco gradle plugins, and the gradle command is `./gradlew --refresh-dependencies build publish jacocoTestReport sonarqube
The doc says the -Dsonar.pullrequest.base property (and other sonar properties) should be set for me by automatically by the SonarCloud Bitbucket add-on. I have no way of knowing the value to pass for the base branch, it depends on what target branch is selected in the pull request.
Yes the Bitbucket project is bound to SonarCloud, in Sonar cloud I see the Bitbucket icon. I created the projects from SonarCloud, which pulled the projects in from the Bitbucket Cloud repos in our Team. All I did in Bitbucket repository was add the Sonar access token and update the gradle build as I’ve described.
Do we need to be using bitbucket pull request pipelines? Then I can get the BITBUCKET_PR_DESTINATION_BRANCH variable to use for the base branch, but that’s going to cost me build minutes, we aren’t using pull request pipelines currently.