Class ExcessiveImportsRule

  • All Implemented Interfaces:
    AstVisitor<Object,​Object>, JavaParserVisitor, JavaVisitor<Object,​Object>, PropertySource, Rule

    public class ExcessiveImportsRule
    extends net.sourceforge.pmd.lang.java.rule.internal.AbstractJavaCounterCheckRule<ASTCompilationUnit>
    ExcessiveImports attempts to count all unique imports a class contains. This rule will count a "import com.something.*;" as a single import. This is a unique situation and I'd like to create an audit type rule that captures those.
    Since:
    Feb 21, 2003
    Author:
    aglover
    • Constructor Detail

      • ExcessiveImportsRule

        public ExcessiveImportsRule()
    • Method Detail

      • defaultReportLevel

        protected int defaultReportLevel()
        Specified by:
        defaultReportLevel in class net.sourceforge.pmd.lang.java.rule.internal.AbstractJavaCounterCheckRule<ASTCompilationUnit>
      • isViolation

        protected boolean isViolation​(ASTCompilationUnit node,
                                      int reportLevel)
        Specified by:
        isViolation in class net.sourceforge.pmd.lang.java.rule.internal.AbstractJavaCounterCheckRule<ASTCompilationUnit>