What mehen emits
Worked example
Why split the count
The LOC family separates concerns that “lines of code” conflates:- SLOC is the simplest size signal — useful for repository-level dashboards.
- PLOC removes whitespace and comments and is closest to “real code”.
- LLOC counts statements, so it is the right axis for comparing language idioms (one Python comprehension vs. a multi-line Rust loop).
- CLOC and Blank are reported separately because comment and whitespace ratios are themselves signals of style and readability.
References
- Park, R. E. (1992). Software Size Measurement: A Framework for Counting Source Statements. CMU/SEI-92-TR-20, Software Engineering Institute, Carnegie Mellon. SEI report — the standard reference for what does and does not count as a “line”.
- Nguyen, V., Deeds-Rubin, S., Tan, T. & Boehm, B. (2007). A SLOC Counting Standard. USC Center for Systems and Software Engineering Technical Report. USC PDF.
- Sonar: Lines of code in metric definitions.
See also
- Concepts → Spaces — how the LOC family aggregates from spaces to files.
- Developers → How-to: implement LoC — internal implementation guide.