Skip to content

Size ​

LOC ​

size.loc — Physical lines of code.

ItemValue
DefinitionNumber of lines in the file.
Scopefile, project
InputFile source text
CalculationCount of lines; a trailing newline does not start a new line. Project: sum over files.
Unitlines
Language Applicabilitylanguage_independent
Limitations-
Reference-

SLOC ​

size.sloc — Source lines of code.

ItemValue
DefinitionLines occupied by at least one non-comment token.
Scopefunction, file, project
InputFile source text, Token ranges
CalculationA token spanning several lines (e.g. a multi-line string) occupies each of them. Function: lines of the function's range (including nested functions). Project: sum.
Unitlines
Language Applicabilitylanguage_independent
Limitations-
Reference-

Comment LOC ​

size.comment_loc — Lines containing only comments.

ItemValue
DefinitionLines occupied by a comment token and by no other token.
Scopefile, project
InputFile source text, Token ranges
CalculationLines with code and a trailing comment are SLOC, not Comment LOC. Project: sum.
Unitlines
Language Applicabilitylanguage_independent
LimitationsDocumentation strings that are string literals (e.g. Python docstrings) count as SLOC.
Reference-

Blank LOC ​

size.blank_loc — Blank lines.

ItemValue
DefinitionWhitespace-only lines not occupied by any token.
Scopefile, project
InputFile source text, Token ranges
CalculationBlank lines inside a multi-line comment or string are not blank. Project: sum.
Unitlines
Language Applicabilitylanguage_independent
Limitations-
Reference-

Comment Ratio ​

size.comment_ratio — Share of comment lines.

ItemValue
DefinitionComment LOC / LOC.
Scopefile, project
Inputsize.comment_loc, size.loc
Calculationnot_applicable when LOC is 0. Project: ratio of the sums.
Unitratio
Language Applicabilitylanguage_independent
Limitations-
Reference-

Statement Count ​

size.statement_count — Number of statements.

ItemValue
DefinitionNodes of kind statement, declaration, branch, loop, return or jump.
Scopefunction, file, project
InputNode kinds
CalculationFunction scope includes nested functions. Project: sum.
Unitcount
Language Applicabilitypartially_language_dependent
LimitationsLanguages differ in what is a statement (e.g. C for-loop initializer declarations count; Python has no equivalent).
Reference-

Token Count ​

size.token_count — Number of non-comment tokens.

ItemValue
DefinitionTokens of every kind except comment.
Scopefunction, file, project
InputTokens
CalculationA string literal is one token. Function scope includes nested functions. Project: sum.
Unitcount
Language Applicabilitypartially_language_dependent
LimitationsToken granularity follows each grammar (e.g. C #include is one token).
Reference-

Function Count ​

size.function_count — Number of functions.

ItemValue
DefinitionFunctions in the IR, including methods, nested and anonymous functions.
Scopefile, project
InputFunctions
CalculationProject: sum.
Unitcount
Language Applicabilitylanguage_independent
Limitations-
Reference-

Function Length ​

size.function_length — Lines spanned by a function.

ItemValue
DefinitionLast line - first line + 1 of the function's source range.
Scopefunction
InputFunction source range
CalculationIncludes the signature, blank and comment lines, and nested functions.
Unitlines
Language Applicabilitylanguage_independent
Limitations-
Reference-

Average Function Length ​

size.avg_function_length — Mean Function Length.

ItemValue
DefinitionMean of size.function_length over all functions.
Scopefile, project
Inputsize.function_length
Calculationnot_applicable when there are no functions.
Unitlines
Language Applicabilitylanguage_independent
Limitations-
Reference-

Maximum Function Length ​

size.max_function_length — Longest Function Length.

ItemValue
DefinitionMaximum of size.function_length over all functions.
Scopefile, project
Inputsize.function_length
Calculationnot_applicable when there are no functions.
Unitlines
Language Applicabilitylanguage_independent
Limitations-
Reference-