How do I trigger a full-codebase scan?

Hi, some questions:

How do we trigger a full-codebase scan for a particular branch? It seems like an analysis is always compared against some previous analysis, but we are not getting a full picture (the lines of code seems to always be less than the total, even for analyses of long-lived branches)

Relatedly, how do we delete previous analyses? I’ve seen references online to deleting “snapshots” from the activity page… but our UI doesn’t give us that option

Thanks

Hi,

Welcome to the community!

Unless you’re in a PR context, every analysis is a full-codebase analysis.

It sounds like you’re looking at the New Code view. In that view, this is certainly the case. In the Overall view, you should see the full picture.

 
HTH,
Ann

That’s what I thought at first, but the reported lines of code analyzed is around half of the actual lines of code in our project. Which suggests it’s not analyzing everything? or maybe it calculates the lines of code differently? How do i reconcile it?

Also, is there a way to clear previous scans?

Hi,

The first step here is to go to the Code tab and figure out what’s missing. We can work from there.

And we’ll need your analysis configuration and analysis logs, probably.

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

I think it’s also the same for Branch analysis. Only new changes on the branch are scanned. The “New Code”/“Overall Code” tabs in the screenshot are only available on the “Main Branch” view.

(I’ve got a similar problem that the code scanned via CI doesn’t include all the code, not even what is checked with Automated scan: Code Inclusion for mvn sonar scanned project)

Hi,

No.

Then it sounds like your other branches are all short-lived branches. For short-lived branches, the full analysis is run, but the results are then filtered to only what’s new.

 
HTH,
Ann

really :thinking: :exploding_head:
the PR summary and the short-lived branch summary are so much the same I would have thought they perform the same. That’s interesting that they don’t.

But there’s still no way to see the full analysis of a short-lived branch, is there?

Hi,

That’s an understandable assumption. On our side, there’s a bit of history that I won’t bore you with (except to say that short-lived branches were phased out on the SonarQube side quite a while ago).

There is not.

And once a branch is created, there’s no way to change its type. What you would need to do is delete the branch, update your long-lived branch pattern and then re-analyze the branch to re-create it as long-lived in order to see everything in it.

 
HTH,
Ann