Sonar cloud shows very old bugs on new PR

I have a c++ project with an old codebase. Configured “new code”, but sonarcloud shows old bugs on PR even if the PR didn’t change any of that source files (in fact PR has changed only github workflow files completely not affecting source code.). Moreover, the count of bugs varies if I run analysis several times on the same PR.

How can I fix this behavior?

Hi @vahagnv

Old issues showing up on a PR can happen if the Sonar Scanner does not have access to the Git history (on the .git folder, and not limited to the last commit) when doing the analysis.
Could you share with us some details about your setup: which CI is used, and the commands used to clone the sources and run the analysis (the pipeline script, if any)?

Hi @Claire_Villard.
Thanks. I’ve fixed the issue. The problem is in the shallow clone.

1 Like

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