Pull Request's analysis shows issues they weren't introduced in the PR

Version 7.9.2

The Pull Request’s analysis show issues in code that is not related to the pull request

Screenshot from CodeCloud PR decoration

I am struggling to understand what is the origin of the issue and why they appear in the Pull Request analysis and not in the master branch analysis.

Any help will be appreciated. Thanks!

Hi @mrvincenzo,

Your screenshot reveals that the last analysis had 2 warnings: I suggest you investigate them. Particularly if they relate to SCM issues.

I also noticed in your screenshot you’re running our Data Center Edition, which means you or your company almost certaily have access to our commercial support team. I suggest you file a ticket with us via that channel.


Thank you @Jeff_Zapotoczny. I will check if we have commercial support.

Anyhow, one of the warning was related to PR decoration. I fixed it. The other one is

Do you think it can cause SonarQube to mistakenly identify old code (not related to the Pull Request) as new code?

I did a full clone instead of shallow clone. It did make the warning go away but it didn’t fix the original problem.

Now that you’ve eliminated the warnings as a source of potential problem, the next steps I can suggest:

  • Confirm whether it’s really true the file(s) involved in those issues really weren’t changed as part of the PR. If you drill all the way into the issue where you can see the code in its context, what does the “blame” data in the left margin tell you about the commit SonarQube sees this was a part of? Is it really not a commit involved in the PR?
  • Check your analysis logs for anything strange involving the file(s), e.g. character encoding warnings or anything like that

FYI, We’ve made improvements in the configuration and calculation of what is “New Code” in the new 8.9 LTS release. I encourage you to consider an upgrade along with investigating internally to see about your access to our commercial support team.

1 Like

We managed to make SonarQube correctly recognize New Issues.

After enabling full clone BOTH for the master branch and for the Pull Request branches, SonarQube started to recognize New Issues correctly (enabling full clone for only the master branch or for the PR branch didn’t make any difference).

Thanks for the help @Jeff_Zapotoczny

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