Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 38 |  | Methods: | 3
| NCLOC: | 23 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
NcssMethodCount.java | 100% | 100% | 100% | 100% |

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.ASTMethodDeclaration;
8 |  | import net.sourceforge.pmd.stat.DataPoint;
9 |  |
10 |  | /**
11 |  | * Non-commented source statement counter for methods.
12 |  | *
13 |  | * @author Jason Bennett
14 |  | */
15 |  | public class NcssMethodCount extends AbstractNcssCount {
16 |  |
17 |  | /**
18 |  | * Count the size of all non-constructor methods.
19 |  | */
20 | 13 | public NcssMethodCount() {
21 | 13 | super( ASTMethodDeclaration.class );
22 |  | }
23 |  |
24 | 4 | public Object visit(ASTMethodDeclaration node, Object data) {
25 | 4 | return super.visit( node, data );
26 |  | }
27 |  |
28 | 4 | protected void makeViolations(RuleContext ctx, Set p) {
29 | 4 | Iterator points = p.iterator();
30 | 4 | while ( points.hasNext() ) {
31 | 1 | DataPoint point = (DataPoint) points.next();
32 | 1 | addViolation( ctx, point.getNode(), new String[] {
33 |  | ( (ASTMethodDeclaration) point.getNode() ).getMethodName(),
34 |  | String.valueOf( (int) point.getScore() ) } );
35 |  | }
36 |  | }
37 |  |
38 |  | }