Linecount doubled? How does SQ calculate LoC, before or after exclusions?

Currently using SQ 8.0 Developer Edition (will update to 8.1 in near future)
MSBuildSonarQube Runner version

Have a very large project, 1,067,000~ lines total; however we only wish to analyze our .NET code, not .js etc.
Scans were successful, as you can see from the image below the total linecount was reading as 552K which matches our .NET code.

Suddenly, SQ is saying I have >1M lines of code.

Why? I have reached out to sonarsource to try and get information on how the count is derived but they were unable/unwilling to shed any light on that.

I feel like it is counting the exclusions, which you can also see in the image below :

Any help / leads greatly appreciated.


Excluded lines are completely excluded - from analysis and line count - as shown by the Lines of Code value on your project homepage.

I’d start debugging this on the Projects page which, among other things, categorizes projects in size buckets. If you can’t figure it out from there, then you’ll want to look at your large projects’ branches. For server LoC SonarQube takes the single largest branch of each project. So you could have a master branch of 1 LoC that counted as 1M if it had a branch that size under analysis. Unfortunately in that case, what you’ll see on the project homepage and in the Projects page is 1, not 1M.


Wound up deleting the project, then letting the analysis run over night (no change) and it magically works.

1 Like