JavaNCSS Metric Results

[ package ] [ object ] [ function ] [ explanation ]

The following document contains the results of a JavaNCSS metric analysis.
JavaNCSS web site.

Packages

[ package ] [ object ] [ function ] [ explanation ]

Packages sorted by NCSS.

PackageClassesFunctionsNCSSJavadocsJavadoc linesSingle lines commentMulti lines comment
org.springunit.framework42413128311160
org.springunit.framework.junit441156216084
Classes totalFunctions totalNCSS totalJavadocsJavadoc linesSingle lines commentMulti lines comment
835187303271144

Objects

[ package ] [ object ] [ function ] [ explanation ]

TOP 30 classes containing the most NCSS.

ObjectNCSSFunctionsClassesJavadocs
org.springunit.framework.HierarchicalSpringUnitContext66809
org.springunit.framework.SpringUnitTransactionalTest20809
org.springunit.framework.junit4.NameRunner18501
org.springunit.framework.SpringUnitContext16405
org.springunit.framework.SpringUnitTest12405
org.springunit.framework.junit4.NameListener9201
org.springunit.framework.junit4.SpringUnit4Test6200
org.springunit.framework.junit4.SpringUnit4TransactionalTest6200

TOP 30 classes containing the most functions.

ObjectNCSSFunctionsClassesJavadocs
org.springunit.framework.HierarchicalSpringUnitContext66809
org.springunit.framework.SpringUnitTransactionalTest20809
org.springunit.framework.junit4.NameRunner18501
org.springunit.framework.SpringUnitContext16405
org.springunit.framework.SpringUnitTest12405
org.springunit.framework.junit4.NameListener9201
org.springunit.framework.junit4.SpringUnit4Test6200
org.springunit.framework.junit4.SpringUnit4TransactionalTest6200
Averages.
NCSS averageProgram NCSSClasses averageFunctions averageJavadocs average
19.13187.000.004.383.75

Functions

[ package ] [ object ] [ function ] [ explanation ]

TOP 30 functions containing the most NCSS.

FunctionsNCSSCCNJavadocs
org.springunit.framework.HierarchicalSpringUnitContext.createDataFileName(Class)1521
org.springunit.framework.HierarchicalSpringUnitContext.simpleOrFullyQualifiedName(String)1341
org.springunit.framework.SpringUnitContext.getObject(String,String,Map)851
org.springunit.framework.HierarchicalSpringUnitContext.createDataFileNames(List)721
org.springunit.framework.HierarchicalSpringUnitContext.buildTestClasses(List,Class)751
org.springunit.framework.junit4.NameRunner.getTestMethodName()740
org.springunit.framework.HierarchicalSpringUnitContext.getObject(String,String,Object)641
org.springunit.framework.HierarchicalSpringUnitContext.getObject(String,String,Class,Object)611
org.springunit.framework.junit4.NameListener.testFinished(Description)640
org.springunit.framework.HierarchicalSpringUnitContext.HierarchicalSpringUnitContext(Class)411
org.springunit.framework.HierarchicalSpringUnitContext.getConfigLocations()421
org.springunit.framework.SpringUnitTest.SpringUnitTest(String)411
org.springunit.framework.SpringUnitTransactionalTest.SpringUnitTransactionalTest(String)411
org.springunit.framework.SpringUnitTransactionalTest.onTearDownAfterTransaction()411
org.springunit.framework.junit4.NameRunner.run(RunNotifier)310
org.springunit.framework.junit4.SpringUnit4Test.callSetUp()310
org.springunit.framework.junit4.SpringUnit4TransactionalTest.callSetUp()310
org.springunit.framework.junit4.NameListener.testStarted(Description)220
org.springunit.framework.junit4.NameRunner.NameRunner(Class)210
org.springunit.framework.junit4.NameRunner.getTestName()210
org.springunit.framework.junit4.NameRunner.setTestName(String)210
org.springunit.framework.junit4.SpringUnit4Test.callTearDown()210
org.springunit.framework.junit4.SpringUnit4TransactionalTest.callTearDown()210
org.springunit.framework.SpringUnitContext.getData()211
org.springunit.framework.SpringUnitContext.getObject(String,String)211
org.springunit.framework.SpringUnitContext.setData(Map)211
org.springunit.framework.SpringUnitTest.SpringUnitTest()211
org.springunit.framework.SpringUnitTest.getConfigLocations()211
org.springunit.framework.SpringUnitTest.getObject(String)211
org.springunit.framework.SpringUnitTransactionalTest.SpringUnitTransactionalTest()211

Averages.

Program NCSSNCSS averageCCN averageJavadocs average
187.003.941.690.69

Explanations

[ package ] [ object ] [ function ] [ explanation ]

Non Commenting Source Statements (NCSS)

Statements for JavaNCSS are not statements as specified in the Java Language Specification but include all kinds of declarations too. Roughly spoken, NCSS is approximately equivalent to counting ';' and '{' characters in Java source files.

Not counted are empty statements, empty blocks or semicolons after closing brackets. Of course, comments don't get counted too. Closing brackets also never get counted, the same applies to blocks in general.

ExamplesComments
Package declarationpackage java.lang;
Import declarationimport java.awt.*;
Class declaration
  • public class Foo {
  • public class Foo extends Bla {
Interface declarationpublic interface Able ; {
Field declaration
  • int a;
  • int a, b, c = 5, d = 6;
Method declaration
  • public void cry();
  • public void gib() throws DeadException {
Constructor declarationpublic Foo() {
Constructor invocation
  • this();
  • super();
Statement declaration
  • i = 0;
  • if (ok)
  • if (exit) {
  • if (3 == 4);
  • if (4 == 4) { ;
  • } else {
expression, if, else, while, do, for, switch, break, continue, return, throw, synchronized, catch, finally
Label declarationfine :normal, case, default
In some cases consecutive semicolons are illegal according to the JLS but JavaNCSS still tolerates them (thought JavaNCSS is still more strict as 'javac'). Nevertheless they are never counted as two statements.Cyclomatic Complexity Number (CCN)CCN is also know as McCabe Metric. There exists a much hyped theory behind it based on graph theory, but it all comes down to simply counting 'if', 'for', 'while' statements etc. in a method. Whenever the control flow of a method splits, the "CCN counter" gets incremented by one.Each method has a minimum value of 1 per default. For each of the following Java keywords/statements this value gets incremented by one:
  • if
  • for
  • while
  • case
  • catch
Also if the control flow of a method returns abortively the CCNvalue will be incremented by one:
  • if
  • for
An ordinary return at the end of method (no matter if it's a function or a procedure) will not be counted.Note that else, default, and finallydon't increment the CCN value any further. On the other hand, a simple method with a switchstatement and a huge block of casestatements can have a surprisingly high CCN value (still it has the same value when converting a switchblock to an equivalent sequence of if statements).