Sonar Qube Analysis on Pull Request Branch in Azure considers old code

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube * Enterprise Edition * Version 7.9.1 (build 27448)
  • what are you trying to achieve
    Trying to implement Sonarqube analysis on Pull Request Branch in Azure Devops.
  • what have you tried so far to achieve this
    The analysis works fine without issues. But the analysis shows issues which were not part of the pull request. I tried changing parameter in New Code Period to Default\1. It doesnt work.

Can Sonarqube only show issues related to new PR only? We are planning to implement Pull request decoration as the next step and it will be useful if the developer as to work only on his issues.


Hello @Nick!

Welcome to SonarSource community.

Can Sonarqube only show issues related to new PR only?

Sure it can! In fact this is where the value of analysing/decorating PRs is.
I think you need to have a look at how your code is checked-out and which files get analysed more precisely. You are welcome to share analysis logs and screenshots that would picture the issue.


Hi @Krzysztof_Jazgara,

I went through the community posts and figured out that this issue occurs when we have less than 20 lines in new pull request? Is it still the case?

My pull request had less than 20 lines. Also when i tried to decorate pull requests it showed me 20 issues on my pull requests which were not part of my changes.

Our Sonar Servers are down at the moment,I will add screenshots asap.

We are having same issue, When we had created pull request and ran analysis its analyzing old code to, so its not meeting coverage gates percentage and its failing. due to this we are not able to complete Pull request.

what is cause for this issue?

screen shots:

above is PR for Post service, and it has only one file(FeaturedPostMapTest.cs) change, but after we had ran sonar analysis its showing changes in below files, which are not modified/created with this PR:

please check and let us know what might be the cause?

we are using SonarQube community version: 7.7