01: package org.acm.seguin.pmd.rules;
02:
03: import net.sourceforge.jrefactory.ast.ASTCompilationUnit;
04: import net.sourceforge.jrefactory.ast.ASTImportDeclaration;
05: import org.acm.seguin.pmd.rules.design.ExcessiveNodeCountRule;
06:
07: /**
08: * ExcessiveImportsRule attempts to count all unique imports a class
09: * contains. This rule will count a "import com.something.*;" as a single
10: * import. This is a unqiue situation and I'd like to create an audit type
11: * rule that captures those.
12: *
13: * @since Feb 21, 2003
14: * @author aglover
15: *
16: */
17: public class ExcessiveImportsRule extends ExcessiveNodeCountRule {
18:
19: /**
20: * Hook constructor to pass in parent type
21: */
22: public ExcessiveImportsRule() {
23: super (ASTCompilationUnit.class);
24: }
25:
26: /**
27: * Hook method to count imports. This is a user defined value.
28: * @return Object
29: * @param ASTImportDeclaration node
30: * @param Object data
31: */
32: public Object visit(ASTImportDeclaration node, Object data) {
33: return new Integer(1);
34: }
35: }
|