Coverage details are not getting updated for base branch on merge of pull request

  • SonarQube Version: 7.9.3

  • I’ve done PR analysis on my branch and got the results in sonarQube as shown below, it has 31.3% coverage after merge

  • Now on merge of the PR the results are not getting updated in the base branch i.e master branch as shown below, it still shows 31.5% coverage which is the old coverage before merge

Am I missing something or is this feature not supported yet?

Hi, you need to analyze your main branch again to have the results updated there.

Hi, thanks.
I want to automate this process, i.e, In my organisation I will listen to all pull request merge events, so when an event comes I will run branch analysis against that base branch.
Which would be the optimal way to achieve this?
I see that it requires for me to clone the repo and run sonar-scanner command but that would be heavy to clone all the repos. If there is any other way please let me know.

The usual way is to integrate the sonar-scanner in your QA, amongst builds, tests & deployments. Are you using Github/Gitlab/other? What about your CI/CD pipeline, are you using Jenkins for example?

Makes sense that we have to include sonar-scanner during our builds,
but our CI/CD design is in such a way that we decided to run the pipeline on Pull request open(due to other reasons) and not on Pull request merge. So, in pipeline we have added sonar PR analysis step.
Now on merge we have to do branch analysis of that base branch without running any pipeline explicility