Sonar pull Request Analysis getting lot of issues instead of only that pull request change

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this
    I am using SonarQube developer edition * Version 8.2 (build 32929). I am using Cake script to run the sonar analysis using MSBuild sonar scanner. My SCM is GIT with Gerrit code review system.
    I am trying to achieve PR analysis for each check-in created by the developer for a branch in Gerrit.
    I configuration of servers as below:
    One master jenkins, 1 Sonar server with DB, 6 slaves with MSBuild scanners. When a developer made a check-in build will be triggered from Jenkins using Gerrit trigger plug-in, and select any of the above 6 slaves and start build. This calls a Cake script and that have sonar inputs for PR as:
    PullRequestKey = 55724,
    PullRequestBranch = changes/24/55724/6,
    PullRequestBase = “develop”,

I am not getting the correct details in the final analysis results. Its showing lot of files instead the files checked in in the gerrit ref ‘changes/24/55724/6’

Can I get help on this?

Hi,

This is probably a question of your analysis parameters. What are the exact key/value parameter pairs you’re passing in to analysis?

 
Ann

I am passing these as input.

Hi,

Those aren’t the keys you’ll find in the docs.

 
:slight_smile:
Ann

are you speaking of:
Unique identifier of your Pull Request. Must correspond to the key of the Pull Request in your ALM.
e.g.: sonar.pullrequest.key=5
about this key? I am giving a unique number

Hi,

By ‘key’ I mean PullRequestKey versus sonar.pullreqest.key.

 
:slightly_smiling_face:
Ann

Issue got fixed as I am pull request branch from Gerrit I am getting from jenkins Environment variable and pass as branch to Sonar project.