Skip to main content
SLOC (Source Lines of Code) is the total count of physical lines in a source file, including code, comments, and blank lines. It is the simplest possible size metric.

What mehen emits

How it is computed

mehen counts physical lines in the source bytes — every newline-terminated region is one line. Files that do not end with a newline still count the trailing fragment.

When it is useful

  • Repository-level dashboards: total SLOC is a coarse but stable size signal.
  • Trend reports: SLOC delta is what most engineering organizations track week over week.
  • Sanity checking PR size: if a PR adds 5,000 SLOC, that’s worth a comment.
SLOC is not a quality metric. A 50-line file can be more complex than a 500-line one. Use SLOC alongside PLOC, LLOC, Cyclomatic complexity, and Cognitive complexity.

References

  • Park, R. E. (1992). Software Size Measurement: A Framework for Counting Source Statements. CMU/SEI-92-TR-20. SEI report.
  • Nguyen, V., Deeds-Rubin, S., Tan, T. & Boehm, B. (2007). A SLOC Counting Standard. USC. USC PDF.
  • Sonar: ncloc in metric definitions.

See also

  • LOC family — overview of all five LOC variants.
  • PLOC — instruction lines only.
  • LLOC — logical (statement) lines.