Managing Pull Reqests branches with SonarQube

Hello All !
I am using SonarQube 9.9
We have in our project a pull request integration with a master branch and we manage it in VSTS.
I have already added the plugin in VSTS in order to manage SonarQube.
I have configured the 3 steps in vsts:

  • Prepare analysis on SonarQube
  • Run Code analysis
  • Publish Quality Gate result

I have configured Prepare analysis like this:
Product Key = MyProduct Key
ProjectName = MyProjectName
Project Version = 1.0 (but not sure what is the best practice ?)

My problem is:
In The SonarQube gateway I see the result of the analysis on my try of merge with master branch but in the issues I can see, there are lines of code not at all linked to the branch I have analyzed but linked to another pull request.
I add that we launch many analysis on different branches on paralel
Moreover in the Code tab of the gateway I do not find the code of the branch submitted but code of another branch.

Is there something to add to my configuration in order to avoid SOnarQube mix the analysis data of differents pull request ?

I have search many time on internet but cannot find any similar problem.

Many thanks for you help


Welcome to the community!

I believe this is not about your analysis configuration, but about your checkout.

Can you check the PR Prerequisites and make sure they’re all met?


Many thanks for your help and your welcome :slight_smile:
Actually I found my problem and you had the good advise.
The clue was in the warning of my analysis.
There were “Shallow fetch” checked in my source checkout
Removing it solved my problem.

Thanks and have a good end of week

1 Like