Scanner analyses PRs but not master branch

  • ALM used GitHub
  • CI system used GitHub Actions
  • Project key: Rapptr-Web
"master" branch has not been analyzed yet and you have multiple branches already. It looks like it is not your Main Branch, check your configuration.

Sonarscanner analyses the Pull Requests and uploads results to SonarCloud. Results of scans are visible in the interface for the PRs. However this doesn’t update the master branch, even after the PRs have been merged. We are definitely using master as our main branch.

The second issue, which arises from this, is that when SonarCloud decorates the PRs it shows all the issues coming from the total code, rather than showing the issues introduced by the PR. This is probably because there is no code in the master branch to do a diff with.

What needs to be done?

Hello!

You have to setup your Github Action to make sure it runs too when a commit is pushed on master. Doing so will trigger the analysis of master branch and update it inside SonarCloud.

Exactly, the issues showed in the PR are those on the new code compared to the target branch (master in your case), and if this branch is not analyzed then everything is new for SonarCloud and all issues are reported. Making sure your master branch triggers the Github Action for every commit should fix this behavior.

I"m experiencing the same problem, but I DO have an action that fires whenever code is merged into master. It’s the same action that fires on PR creation. Here’s a link to its most recent run as of last night:

facing the same issue in Bitbucket

1 Like

I have the same issue with GitHub :frowning:

Hey @tkamalov and @Caio_Granero

Instead of bumping this old thread, let me suggest you raise a new thread with all the details asked for in the template post.

I will close this thread.