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 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| public class NcssMethodCount extends AbstractNcssCount { |
16 |
| |
17 |
| |
18 |
| |
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 |
| } |