Trac #129: Report cyclomatic complexity.
diff --git a/org.jacoco.doc/docroot/doc/counters.html b/org.jacoco.doc/docroot/doc/counters.html
index 7197ba0..accb04d 100644
--- a/org.jacoco.doc/docroot/doc/counters.html
+++ b/org.jacoco.doc/docroot/doc/counters.html
@@ -50,12 +50,13 @@
<code>switch</code> statements. This metric counts the total number of such
branches in a method and determines the number of executed or missed branches.
Branch coverage is always available, even in absence of debug information in
- the class files.
+ the class files. Note that exception handling is not considered as branches
+ in the context of this counter definition.
</p>
<p>
If the class files haven been compiled with debug information decision points
- can be mapped to source lines and hightighted accordingly:
+ can be mapped to source lines and highlighted accordingly:
</p>
<ul>
@@ -65,6 +66,47 @@
<li>Full coverage: All branches in the line have been executed (green diamond)</li>
</ul>
+<h2>Cyclomatic Complexity</h2>
+
+<p>
+ JaCoCo also calculates cyclomatic complexity for each non-abstract method and
+ summarizes complexity for classes, packages and groups. According to its
+ definition by
+ <a href="http://hissa.nist.gov/HHRFdata/Artifacts/ITLdoc/235/title.htm">McCabe1996</a>
+ cyclomatic complexity is the minimum number of paths that can, in (linear)
+ combination, generate all possible paths through a method. Thus the
+ complexity value can serve as an indication for the number of unit test cases
+ to fully cover a certain piece of software. Complexity figures can always be
+ calculated, even in absence of debug information in the class files.
+</p>
+
+<p>
+ The formal definition of the cyclomatic complexity v(G) is based on the
+ representation of a method's control flow graph as a directed graph:
+</p>
+
+<blockquote>
+ v(G) = E - N + 2
+</blockquote>
+
+<p>
+ Where E is the number of edges and N the number of nodes. JaCoCo calculates
+ cyclomatic complexity of a method with the following equivalent equation based
+ on the number of branches (B) and the number of decision points (D):
+</p>
+
+<blockquote>
+ v(G) = B - D + 1
+</blockquote>
+
+<p>
+ Based on the coverage status of each branch JaCoCo also calculates covered and
+ missed complexity for each method. Missed complexity again is an indication
+ for the number of test cases missing to fully cover a module. Note that as
+ JaCoCo does not consider exception handling as branches try/catch blocks will
+ also not increase complexity.
+</p>
+
<h2>Lines</h2>
<p>