How LOC is computed in SonarQube?

We have to quickly evaluate our Java projects LOCs in order to estimate the SQ subscription cost. We don’t have the opportunity to configure a SonarQube analysis to get these metrics. Of course we need to count LOC in a consistent way with the SQ engine. It seems that SQ uses the physical lines metric, do you confirm that? Which tool could we use to produce a consistent value?

1 Like


SonarQube does not use a raw physical lines value, but Lines of Code. You could get a rough (over-)estimate by looking at physical lines and subtracting blank lines and comment lines.

Sorry, but the best “tool” here is SQ itself. :smiley:


Thanks for your answer Ann!