Issues on pull requests about old code

  • ALM used - Azure DevOps
  • CI system used - Azure DevOps
  • Languages of the repository - C#

Hi,

Sorry if this question was already asked or if its answered in a tutorial/FAQ but I couldn’t find it

Our Pull Request analysis is systematically bringing up issues about methods not modified in a file that was modified (another method was added/modified)

Is there a way to disable that so that only new code is analyzed ?

We know we have a lot of technical debt to pay but we don’t want to bring it up to every developer at every pull request, as long as they don’t add up new debt.

Thanks,

1 Like

Hi Paul,

This could happen when the new code lines are not correctly detected, typically by misconfiguration.

  • What is the SCM of the project?
  • Are you sure the value of sonar.pullrequest.base is correct?
  • If you browse the Code tab of the pull request on SonarCloud, do you see only the files modified by the pull request?
    • And in each file, do you see a yellow background for the modified lines (as opposed to white for unmodified lines)

Hi Janos,

Thanks for your reply.

  • What is the SCM of the project?

I am not sure what you mean by SCM but if it is Source Control, we are using git, our repository is hosted on Azure Devops servers

  • Are you sure the value of sonar.pullrequest.base is correct?

No I am not, it should be master, I don’t see anywhere in our build pipeline the parameter being overriden, how can I check it is using master during analysis ?
image
It seems to be master

  • If you browse the Code tab of the pull request on SonarCloud, do you see only the files modified by the pull request?

Yes

  • And in each file, do you see a yellow background for the modified lines (as opposed to white for unmodified lines)

Only for the modified lines

Yes by SCM I meant source control, so Git, thanks.

As for sonar.pullrequest.base, based on your responses about the Code tab, your setting must be correct. Unless there’s a misunderstanding. It would be good to find where this is set in your pull request analyses, because I don’t think we have a way to detect automatically, it must be specified somewhere, and it’s a key piece of information.

I will ask you in a private thread about an example of an issue that should not be raised on the PR.