Comment Mix Up in Pull Requests (Azure DevOps)

We are using SonarQube 9.3/ Prepare Analysis Configuration 5.4.0/SonarScanner for MSBuild 5.5.3.

It happens to us that when two open Pull Requests targeting the same branch, SonarQube mixes up the Pull Requests Comments.

For example: If File A was modified within PR A, the SonarQube is appended to PR B instead of PR A.

Have you got any ideas what we are doing wrong here or how we can solve this issue?

I really appreciate any help you can provide.

Hi,

Welcome to the community!

I’m not quite sure what to make of this. Could you provide screenshots of misdirected PR comments (ideally showign both PR A and PR B), as well analysis logs?

 
Thx,
Ann

Hi Ann,

thank you for your immediate answer.

Attached you will find the analysis log and some screenshots:

sonarqube_analysis_pr_Remove-references-to-static-Rights-methods.txt (1.2 MB)
Screenshot of affected files (Pull Request A)


Files Overview of Sonarqube Analysis for the specific Pull Requests

Pull Request B - these files are also included in analysis of Pull request A

I hope this clears it up a bit.

So, from my point of view the Sonarqube analysis of Pull Request A analyzes also changes which were done on a different branch (Pull Request B).

Thank you very much,

Lars

Hi Lars,

I notice this in your analysis log:

2022-03-29T13:10:44.1501459Z INFO: SCM Publisher is disabled

It’s quite likely that that’s playing into this. Without SCM info it’s not clear to me that the server has what it needs to identify the correct PR to decorate. You might check the Scanner Context (Project Settings → Background Tasks → [cog menu] → Scanner Context) for this job. You might also re-enable SCM info.

 
Ann

Hi Ann,

your advice fixed the issue. After setting sonar.scm.disabled to false, the pull requests are properly annotated again.

Thank you so much for your help,

Lars