LoC a lot more calculated than actually there

Sonarqube Enterprise Edition
Version: 8.9.10


I have a issue regarding to the calculation of Lines of Code in our License. Our License contains 10M LoC in the Enterprise Edition of Sonarqube. The “Lincense Manager” in our Sonarqube instance shows that we have used up 1.7M LoC but if we look at the project overview and the lines there shown, it shows only about 680k “Lines”. When we navigate into a specific project and then in the Activity Overview we choose “Custom” in the select box for the metrics. Then we add the two metrics “Lines of Code” and “Lines” it shows that the project itself has about 625k Lines of Code, but has about 1M Lines which are including blank lines (basically the count of carriage return) from our understanding. So it looks like as the metric “Lines” is taken for the calculation of the “Lines of Code” in the License.

Further in your Documentation Documentation there is a explanation for the Lines of Code. As you can imagine this issue is impacting a lot our used Lines of Code in our License. Is this intended or is this a Bug in the calculation of the Lines of Code?

Thank you in advance for your response!

Best Regards

hi @velicb

Lines of Code taken into account for the license are not including blank or comments lines.
The difference you may see could be because your projects is displaying the main branch, whereas the license counts the largest branch of each project (which is not always the same as the main branch).

Can you check the branches and see if I’m right here?



thank you for your quick response. Turns out that this exactly was the issue. We had one branch in one of our projects where the excludes where not set properly so it took libraries we used into the count. It was just difficult to see because the overview showed only the branch where the excludes where properly set. Is there another quick way to see the branch with the most lines without looking at each branch manually?

Again, thank you for the quick response, appreciate it really!


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.