SLOC means Source Lines of Code, but it is a family of measures rather than one universal total. A physical count follows text rows; a logical count follows language constructs. SourceTally deliberately reports physical line segments terminated by LF, CRLF, or CR, plus a final unterminated segment, and marks whitespace-only lines separately. It does not label that total as comment-free or logical SLOC.
A useful SLOC definition must name its counting rule
Before comparing two SLOC values, state whether they are physical lines or logical statements and whether blank lines, comments, generated files, tests, vendored dependencies, and failed files are included. Also record the tool and version. Without those choices, the same label can describe different populations and the totals are not comparable.
Formatting can change physical SLOC without changing the statement
The declaration const total = price * quantity; occupies one physical line and is one logical statement. Break the same declaration after the equals sign and before the semicolon and it occupies three non-empty physical lines while remaining one declaration. A physical counter should report the layout change; a logical counter needs a JavaScript grammar to recognize the unchanged construct.
Physical lines describe layout
One compact statement may occupy one line or twenty lines after formatting. A minified bundle may contain a large amount of behavior on one physical line. Conversely, documentation, configuration, test fixtures, generated clients, and data files can add many lines without adding application logic. Use physical totals to inventory a snapshot, not to rank engineering ability.
Logical SLOC needs a grammar
A logical source line usually tries to count language constructs rather than visual rows. Semicolons, significant indentation, multiline expressions, macros, templates, embedded languages, strings, and preprocessor branches make that definition language-specific. SourceTally does not pretend that splitting text or matching punctuation can produce one authoritative logical count across dozens of languages.
Compare only like-for-like runs
Record the commit or local snapshot, exclusions, failed files, encoding boundary, generated-file choice, and tool version. A difference is meaningful only when those conditions match. Even then, more lines may reflect tests, safer validation, clearer documentation, generated interfaces, or duplication. Treat the number as a navigational signal that prompts inspection, never as a standalone performance target.
Comments require lexical context
The same characters may start a comment, occur inside a string, appear in a regular expression, or belong to another embedded language. Block comments can cross chunks and lines. Documentation comments may be source, API documentation, or both. A reliable code/comment split needs reviewed lexers and explicit policies, so the first release reports only total, blank, and non-empty physical lines.