Code Metrics

Description and example of code metrics

When Polyspace® Bug Finder™ analyzes your code, you can choose to calculate statistics about your program. Use the Calculate code metrics (-code-metrics) analysis option to activate code metric checking. To understand the different code metric results and how Bug Finder calculates them, see these reference pages.

Polyspace Results

expand all

Number of Direct RecursionsNumber of instances of a function calling itself directly
Number of Header FilesNumber of included header files
Number of FilesNumber of source files
Number of RecursionsNumber of call graph cycles over one or more functions
Comment DensityRatio of number of comments to number of statements
Estimated Function CouplingMeasure of complexity between levels of call tree
Number of LinesTotal number of lines in a file
Number of Lines Without CommentNumber of lines of code excluding comments
Cyclomatic ComplexityNumber of linearly independent paths in function body
Higher Estimate of Local Variable SizeTotal size of all local variables in function
Language ScopeLanguage scope
Lower Estimate of Local Variable SizeTotal size of local variables in function taking nested scopes into account
Number of Call LevelsMaximum depth of nesting of control flow structures
Number of Call OccurrencesNumber of calls in function body
Number of Called FunctionsNumber of callees of a function
Number of Calling FunctionsNumber of distinct callers of a function
Number of Executable LinesNumber of executable lines in function body
Number of Function ParametersNumber of function arguments
Number of Goto StatementsNumber of goto statements
Number of InstructionsNumber of instructions per function
Number of Lines Within BodyNumber of lines in function body
Number of Local Non-Static VariablesTotal number of local variables in function
Number of Local Static VariablesTotal number of local static variables in function
Number of PathsEstimated static path count
Number of Return StatementsNumber of return statements in a function

Topics

HIS Code Complexity Metrics

See which code complexity metrics supported in Polyspace are part of the Hersteller Initiative Software (HIS) standard.