Sonarcloud DevOps Pull-Request analysis seems to analyze all files

  • ALM used (Azure DevOps)
  • CI system used ( Azure DevOps)
  • Scanner command used when applicable (private details masked)
  • Languages of the repository (C#)

We have a Pull Request with only one file changed, but the SonarCloud scanner produces 50 or more issues within the other files of the project.

Suddenly all our Pull Requests has the same probleem with hunderd of issues.

We donnot know what caused this problem.

We tried to set the projectBaseDir because of an error "This file no longer exists in the latest pull request changes.

sonarExtraProperties: |
sonar.projectBaseDir

But this did not change a thing.

Hope somebody can help us to figure out our problem.

Kind Regards,

Adrie den Blanken

Hi,

Typically when you see issues on old code reported in a pull request, it’s because there was a problem reading the SCM data, which is how analysis determines what’s new. Either that, or the branch being targeted by the PR wasn’t available in the local repository.

If you check the bottom of your analysis log, do you see a message about SCM detection being disabled?

 
Ann

1 Like

Hi Ann,

At the PR i see the next warning “The last analysis has warnings. See details.”

  • Could not find ref ‘main’ in refs/heads, refs/remotes/upstream or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis.

  • Shallow clone detected during the analysis. Some files will miss SCM information. This will affect features like auto-assignment of issues. Please configure your build to disable shallow clone.

Could one these two warnings be the problem?

And what to do in that case?

Hi,

Yes, both of these warnings are relevant in this case.

The docs should help.

 
Ann

Hi Ann,

Is there a tip of the veil (as we say in the Netherlands), because apparently we don’t have enough Git knowledge in the team to immediately understand where the problem is.

Hopefully you can point us in the right direction.

Adrie