Clover coverage report - PMD - 3.9
Coverage timestamp: Tue Dec 19 2006 09:38:44 EST
file stats: LOC: 43   Methods: 3
NCLOC: 28   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NcssConstructorCount.java 100% 83.3% 66.7% 81.8%
coverage coverage
 1    package net.sourceforge.pmd.rules.codesize;
 2   
 3    import java.util.Iterator;
 4    import java.util.Set;
 5   
 6    import net.sourceforge.pmd.RuleContext;
 7    import net.sourceforge.pmd.ast.ASTConstructorDeclaration;
 8    import net.sourceforge.pmd.ast.ASTExplicitConstructorInvocation;
 9    import net.sourceforge.pmd.stat.DataPoint;
 10    import net.sourceforge.pmd.util.NumericConstants;
 11   
 12    /**
 13    * Non-commented source statement counter for constructors.
 14    *
 15    * @author Jason Bennett
 16    */
 17    public class NcssConstructorCount extends AbstractNcssCount {
 18   
 19    /**
 20    * Count constructor declarations. This includes any explicit super() calls.
 21    */
 22  13 public NcssConstructorCount() {
 23  13 super( ASTConstructorDeclaration.class );
 24    }
 25   
 26  0 public Object visit(ASTExplicitConstructorInvocation node, Object data) {
 27  0 return NumericConstants.ONE;
 28    }
 29   
 30  4 protected void makeViolations(RuleContext ctx, Set p) {
 31  4 Iterator points = p.iterator();
 32  4 while ( points.hasNext() ) {
 33  1 DataPoint point = (DataPoint) points.next();
 34    // TODO need to put class name or constructor ID in string
 35  1 addViolation(
 36    ctx,
 37    point.getNode(),
 38    new String[] {
 39    String.valueOf( ( (ASTConstructorDeclaration) point.getNode() ).getParameterCount() ),
 40    String.valueOf( (int) point.getScore() ) } );
 41    }
 42    }
 43    }