Pull request analysis is analysing entire codebase

Our bitbucket repo is connected in SonarCloud and is being executed in our Azure DevOps Pipelines.

Some of our pull requests are failing the code analysis as it appears to be analyzing the entire codebase.

The PRs that fail show the new line count is over 300K new lines which is close to our repo size. When you click on the PR link to go back to bitbucket the PR is looking correct with the correct number of files and lines changed.

We have about half our pull requests showing the correct number of lines in their PRs while the others are all showing over 300K.

What could be causing this?

What could be causing the wrong diff to be calculated?

Hi,

Welcome to the community!

Analysis uses SCM blame data to determine what was changed in the PR. So if these PRs are truly being analyzed as PRs, then the question is why the SCM blame data isn’t showing what you expect it to.

In previous instances of “way too much shows up as new” the problem has been automated linebreak/whitespace “correction” processes. I.e. automatically change all tabs to spaces before/during commit. Altho, to be honest, I haven’t seen that one in quite a while.

Can you share your analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann