Information Technology Reference
In-Depth Information
CCN report generated with Maven
FIGURE 7-2
This report section, labeled “Top 30 functions containing the most
NCSS (Noncommenting Source Statements),” details the largest meth-
ods in the code base, which usually correlate to high cyclomatic com-
plexity. For instance, the report lists the class BeerDaoImpl 's
findAllStates method as having 238 lines of code and a cyclomatic
complexity (labeled as CCN) of 114.
You may be wondering, “So what does that mean?”
Because high cyclomatic complexity values tend to correlate with
defects, our next course of action is to verify the existence of any cor-
responding tests. If there are tests, how many are there? A rule of
thumb for test coverage related to cyclomatic complexity is to have
test cases equal in number to the cyclomatic complexity value (i.e., in
the example of the findAllStates method, 114 test cases would be
required). It would be unlikely to actually have 114 test cases for this
method, but having a few is a great start in reducing the risk of defects
in this method.
Search WWH ::




Custom Search