|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ExcessiveImports.java | - | 100% | 100% | 100% |
|
1 | /** | |
2 | * BSD-style license; for more info see http://pmd.sourceforge.net/license.html | |
3 | */ | |
4 | package net.sourceforge.pmd.rules; | |
5 | ||
6 | import net.sourceforge.pmd.ast.ASTCompilationUnit; | |
7 | import net.sourceforge.pmd.ast.ASTImportDeclaration; | |
8 | import net.sourceforge.pmd.rules.design.ExcessiveNodeCountRule; | |
9 | ||
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 | 3 | public ExcessiveImports() { |
22 | 3 | 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 | 5 | public Object visit(ASTImportDeclaration node, Object data) { |
33 | 5 | return new Integer(1); |
34 | } | |
35 | } |
|