Lines of code used not corresponding between analysis and billing view

Hi,

We switched today to the new SonarCloud plan.

After that our analysis fail with maximum lines reached.

This analysis will make your organization ‘hacksis’ to reach the maximum allowed lines limit (having 415647 lines)

But the count displayed in the billing view is completely different and way inferior.

What is going on ?

Additional information :
This error happen on the Azure Pipeline SonarCloudPublish step.
This only triggers for analysis done with the Sonar Scanner for MSBuild.
The analysis done with the regular Sonar Scanner don’t have this issue.
However the publish step is the same in both cases.

Hi,

Welcome to the community!

The error message will make more sense if we rearrange it slightly:

This analysis (having 415647 lines) will make your organization ‘hacksis’ to reach the maximum allowed lines limit

So your analysis is picking up more code that you expect. You mention a variation between the SonarScanner for MSBuild and the SonarScanner CLI.

Here’s what I think is happening:

.NET code is only anlayzed when the SonarScanner for MSBuild is used. (Surely you’ve seen the warnings in the analysis logs?) So when you use the SonarScanner CLI, you’re picking up everything but the C#.

When you switch to the SonarScanner for .NET, you’re (finally) picking up everything. A few months ago, .NET analysis would have analyzed mainly the C# and ignored the rest, but a change last fall means that .NET analysis is now truly multi-language (like all the other analyses have been all along.*)

 
Ann

* Maven’s/Gradle’s Java-centricity did mean that we didn’t pick up other files by default, but you could configure that on. And now there’s an easy option for those scanners to turn on ‘everything’.

Hi,

The project indeed contains others parts that are not DotNet and I don’t need SonarScanner for MSBuild to analyze those so like you said I will restrict it to C# and see if it’s fix the issue.

But anyway there is an issue here, because the SonarScanner report 415k+ lines and the billings report 311k+ lines.
There is a difference of 100k lines between the two counters.
And the non DotNet lines are already analyzed by the SonarScanner CLI.
So it’s seems that when the two scanners scan the sames lines of code they count them as different and get counted twice.
It’s seems to match because I have around 100k+ line that are not DotNet in this project.

The analysis passed before because the old plan limit was 500k+ but the reported lines in the billing doesn’t reports 400k+ but 300k+ so there is a treatment somewhere that deduplicated those lines in the end but not when the SonarScanner for MSBuild try to submit the analysis report.

Hi,

Again, the two different scanners are looking at different subsets of your code.

I suggest you disable multilanguage analysis in the SonarScanner for .NET.

 
HTH,
Ann