About metrics results
The metrics report provides static testability and complexity measurements of the source files of your project. Source code metrics are created each time a source file is added to the project.
The scope of the metrics report depends on the selection made in the Outline view. This can be a file, one or several classes or any other set of source code components.
The metrics window provides hyperlinks to the actual source code. Click the name of a source component to open the source code editor at the corresponding line.
Complexity metrics
The V(g) or cyclomatic number is a measure of the complexity of a function, which is correlated to the difficulty of testing the function. The typical V(g) for a function is between 1 and 10. A value of 1 means that the code has no branching. The cyclomatic complexity of a function should not exceed 10.
Halstead complexity measurement was developed to measure a program module's complexity directly from source code, with emphasis on computational complexity. The measures were developed by the late Maurice Halstead as a means of determining a quantitative measure of complexity directly from the operators and operands in the module. Halstead provides various indicators of the module's complexity.
The Metrics Viewer presents V(g) and Halstead values of a function in the metrics report when a function is selected in the Outline view. At the Root level, the same statistical treatment is provided for all functions in the source file.
File level metrics
- Comment only lines
- The number of comment lines that do not contain any source code.
- Comments
- The total number of comment lines.
- Empty lines
- The number of lines with no content.
- Source only lines
- The number of lines of code that do not contain any comments.
- Comment only lines
- The number of comment lines that do not contain any source code
- Lines
- The total number of lines in the source file.
- Comment rate
- The percentage of comment lines against the total number of lines.
- Source lines
- The total number of lines of source code
File, Class or Package, and Root Level Metrics
These numbers are the sum of metrics measured for all the components of a given file, class or package.
- Total statements
- total number of statement in child nodes
- Maximum statements
- The maximum number of statements in the selected scope.
- Maximum level
- The highest nesting level reached in the selected scope.
- Maximum V(g)
- The average cyclomatic number of the selected scope.
- Standard deviation V(g)
- Standard deviation V(g) of the selected scope
- Sum of V(g)
- Total V(g) for the selectedscope.