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