Code coverage metrics
Branch coverage (or 'decision coverage') is a code coverage metric that measures which possible branches in flow control structures are followed. Clover does this by recording if the boolean expression in the control structure evaluated to both true and false during execution.
Statement coverage is a code coverage metric that measures which statements in a body of code have been executed through a test run, and which statements have not.
Method coverage is a code coverage metric that measures whether a method was entered at all during execution.
Total Coverage Percentage (Coverage %, TPC)
The Total Coverage Percentage is calculated as follows:
Code complexity metrics
Average Method Complexity (Avg Method Cmp)
The average method complexity of code in the given context. In case of:
- classes: Average Method Complexity = sum of Method Complexity of all class' methods / number of methods in a class
- packages: Average Method Complexity = sum of Method Complexity of all package's methods / number of methods in a package
- project: Average Method Complexity = sum of Method Complexity of all project's methods / number of methods in a project
Complexity (Cmp, Total Cmp)
Cyclomatic complexity of code in the given context.
Cyclomatic complexity of a single method. It's calculated as follows:
- empty method complexity == 1
- simple statement complexity == 0
- switch block complexity == number of case statements
- try catch block complexity == number of catch statements
- ternary expression complexity == 1
- boolean expression complexity == number of && or || in expression
Complexity Density (Cmp Density)
Complexity Density is the average number of paths in your code per statement in given context (method, class, package). It's calculated as follows:
Cmp Density = Complexity / number of statements
Lines Of Code (including comment lines).
Non-Commented Lines Of Code. Lines of code that contain comments are not counted in this metric, leaving only the actual functioning code itself.
Clover currently does not calculate NCLOC for Groovy code (CLOV-1805).