PR comments from Sonar Spamming the Pull Requests in Azure DevOps

We have enabled SonarQube analysis in a Pipeline which runs during Build validation when a Pull Request is raised.

We have turned off “Enable summary comment” in Pull request section under General Settings.

Yet we are seeing the PR comments spamming our Pull Requests.

There are over 200 comments which is decreasing the efficiency of development process.

{00F0A340-BD51-4E0D-B9FB-6F25F3315401}

We are not sure why its populating comments in Pull Requests. And sometimes its also populating comments from older files as well which is not in the current Pull requests.

Kindly help us disable the comments from SonarQube in our Pull Requests.

The parameter you’ve mentioned looks to be functionality for GitHub.

The Comments should only be issues highlighted for your PR, if there are 200+ issues do you not want to address these before merging? If you do address them and then push again Sonar will delete the comments from the PR.

If the issues being flagged are issues you don’t see as wanting to fix for this project then you can disable them or change the config on the rule. I would say it’s better to configure the report to only highlight what you are planning to stick to, rather than have the job of ignoring them on each PR.

I notice the one you’ve shown is a Roslyn issue, these aren’t SonarQube rules and are coming from your build tool, you can disable these using a .editorconfig to list the rules you don’t want to be flagged.

As for it highlighting old files I’m not sure, maybe check what your Quality Gate and New Code are set to.

Hi,

I’d like to augment Paul’s excellent answer by specifically addressing this:

This is going to be a question of the SCM metadata available to analysis. The fact that it happens intermittently tells me that your pipeline doesn’t ensure all the prerequisites are in place. Sometimes you get lucky, and they’re there on the build agent, and sometimes they’re not.

 
HTH,
Ann