1 package net.sourceforge.pmd.rules;
2
3 import net.sourceforge.pmd.ast.ASTCompilationUnit;
4 import net.sourceforge.pmd.ast.ASTImportDeclaration;
5 import net.sourceforge.pmd.rules.design.ExcessiveNodeCountRule;
6
7 /***
8 * ExcessiveImportsRule attempts to count all unique imports a class
9 * 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 }
This page was automatically generated by Maven