Hauptinhalt

Code-Metriken

Beschreibung und Beispiel für Code-Metriken

Wenn Polyspace® Bug Finder™ Ihren Code analysiert, können Sie wählen, ob Statistiken über Ihr Programm berechnen werden sollen. Verwenden Sie die Analyseoption Calculate code metrics (-code-metrics), um die Überprüfung von Code-Metriken zu aktivieren. Lesen Sie die Referenzseiten, um ein Verständnis der verschiedenen Code-Metriken zu gewinnen und zu erfahren, wie Bug Finder sie berechnet.

Die Berechnung von Metriken zur Stacknutzung wird in Polyspace Bug Finder nicht unterstützt. Verwenden Sie zur Berechnung von Metriken zur Stacknutzung Polyspace Code Prover™. Siehe Calculate stack usage (-stack-usage) (Polyspace Code Prover).

Polyspace-Ergebnisse

alle erweitern

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
Comment RatioRatio of number of lines that contain comments to the total number of lines in a file, expressed as percentage
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 blank lines and comment-only lines
Cyclomatic ComplexityNumber of linearly independent paths in function body
Function Comment DensityRatio of number of comments to number of statements in function
Function Stress ComplexityComplexity of internal structure and external connections of a function
Language ScopeCost of maintaining or changing a function
Number of Call LevelsDepth of nesting of control flow statements
Number of Call OccurrencesNumber of calls in function body
Number of Called FunctionsNumber of distinct functions called within the body 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

Themen

  • HIS Code Complexity Metrics

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