LOC limit reached on small .NET project

dotnet
sonarcloud
csharp

(Daniel Louw) #1

Hello - I get the following error whenever I try to analyze a project:

This analysis will make your organization 'platform45' to reach the maximum allowed lines limit. 
Please contact the administrator of the organization to resolve this issue.

Our organization has a 100k limit and I am the administrator.

The project is fairly small, with about !60k LOC as reported by Visual Studio.
It’s a C# .NET project, and I’ve tried analyzing it via Travis and locally using SonarScanner.

Am I doing anything wrong from my side?
Any help would be greatly appreciated!


(Colin Mueller) #2

Daniel,

Are there any other projects scanned in your SonarCloud organisation? It is an overall LoC limit, not per-project.

Colin


(Daniel Louw) #3

Hello, Colin - thanks for the quick response!

Nope, nothing. Only the one project.

Currently on the org billing page it reads
0 private lines of code analyzed over 1 projects

We took out a subscription for 100k lines (10EUR) but we are still on the trial even though a credit card has been added. Could this maybe it the problem?

Regards


(Colin Mueller) #4

Daniel,

You should be able to scan private projects during the free trial, definitely. Perhaps you can create a private project and attempt scanning just a very simple repo (containing a Javascript file, etc.) to verify this!

This would confirm whether the problem is with SonarCloud, or that your .NET solution is larger than perhaps you expected.

And just as you mentioned SonarScanner, can you confirm you’re using the SonarQube Scanner for MSBuild?


(Daniel Louw) #5

Hi Colin - I will try stripping one of the projects within the bigger repo out into a separate repo and scan that.

Yes I used the documentation in that link of yours to install the scanner on my local machine. I think it’s working fine, because after a scan on my local machine I see a new failed background task on SonarCloud with the same error.

Regards


(Fabrice Bellingard) #6

Daniel,

if you’re doing .NET developments, then you should indeed use the Scanner for MSBuild, not the Scanner CLI. The Scanner for MSBuild knows what .NET solutions are, and therefore provides the relevant settings to analyze only what matters for you. On the other side, the Scanner CLI is a general-purpose scanner which doesn’t know anything about the .NET world, so it will try to blindly analyze everything it finds. This probably explains why even if VS reports about 60k LOC for your .NET solution, the analysis will exceed the max number of LOC because the Scanner CLI will include more than just the C# or VB.NET files.

Note that if you are still in trial mode, you can pump up your org to a higher number of LOC. Just make sure that you get back to the threshold you want before the trial ends.