Azure DevOps Pull request comments - only for changed code?

  • Sonar: 10.2
  • License: Enterprise licence

We newly attached sonar scan into our project using azure yaml pipeline. Implementation below.
But after the first run it reported a lot of comments to pull request.

" You have reached the maximum number of displayed issues (50) in this timeline. You can find the complete list of 5222 issues on SonarQube."

Is it possible to configure sonar commenting so that it only reports problems really caused by changes in that pull request?
We have set “new code” as code between versions and our version is every month. So now if any developer creates PR build sonar comments 5222 issues to every PR? (fortunately there is a limit of 50).


Our azure implementation:

Before build:

#Prepare Analysis Configuration task

  • task: SonarQubePrepare@5
    SonarQube: ‘SonarQubeProject’
    scannerMode: ‘MSBuild’
    projectKey: ‘xas-border_cihla_AYpfUTWWefsutADW31’
    displayName: SonarQube Prepare Analysis Configuration

After build:

#Run Code Analysis task

  • task: SonarQubeAnalyze@5
    displayName: SonarQube Code Analysis


That’s how it should be working. If it’s not, it’s quite likely there’s a problem with the gathering of SCM data.

Would you care to share your debug analysis logs?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.


Owww here is the catch. Unfortunately our repo is so big it almost can’t fit into Azure DevOps build agents so we have to make as much space as possible before build. So one of our steps is to delete .git directory :-/

In this case it makes sense. Thanks for clarifying you use .git info to check this info and changes…


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.