Dear Sonar team,
From Sonarqube Metric Definition we have
Number of physical lines (number of carriage returns).
Lines of code (
Number of physical lines that contain at least one character which is neither a whitespace nor a tabulation nor part of a comment.
Sonarqube license are base on LoC, what Sonarqube used as based on pricing (lines or ncloc)?
If it’s ncloc, do Sonarqube count inactive code by #ifdef or #if macro on C Language?
SonarQube pricing is based on
The definition of
ncloc being what you mentioned above, for C/C++, all “branches” of conditional compilation (ie all branches of
#if) are counted as LoC, even the potentially “inactive” branches (they can’t be inactive in all cases, if there’s a preprocessor directive it means that both branches may be compiled).
For macros, the LoC count happens before macro expansions so the block of code in the macro is counted only once (just like a function)