• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pmd / pmd / 167

19 Sep 2025 02:08PM UTC coverage: 78.657% (+0.003%) from 78.654%
167

push

github

adangel
[java] Fix #5878: DontUseFloatTypeForLoopIndices now checks the UpdateStatement as well (#6024)

18176 of 23959 branches covered (75.86%)

Branch coverage included in aggregate %.

39694 of 49614 relevant lines covered (80.01%)

0.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/ExcessiveImportsRule.java
1
/*
2
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3
 */
4

5
package net.sourceforge.pmd.lang.java.rule.design;
6

7
import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit;
8
import net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration;
9
import net.sourceforge.pmd.lang.java.rule.internal.AbstractJavaCounterCheckRule;
10

11
/**
12
 * ExcessiveImports attempts to count all unique imports a class contains. This
13
 * rule will count a "import com.something.*;" as a single import. This is a
14
 * unique situation and I'd like to create an audit type rule that captures
15
 * those.
16
 *
17
 * @author aglover
18
 * @since Feb 21, 2003
19
 */
20
public class ExcessiveImportsRule extends AbstractJavaCounterCheckRule<ASTCompilationUnit> {
21

22
    public ExcessiveImportsRule() {
23
        super(ASTCompilationUnit.class);
1✔
24
    }
1✔
25

26
    @Override
27
    protected int defaultReportLevel() {
28
        return 30;
1✔
29
    }
30

31
    /**
32
     * @deprecated since 7.18.0. This method is not used anymore and shouldn't be implemented.
33
     */
34
    @Deprecated
35
    protected boolean isViolation(ASTCompilationUnit node, int reportLevel) {
36
        throw new UnsupportedOperationException("method is deprecated and not supported anymore.");
×
37
    }
38

39
    @Override
40
    protected int getMetric(ASTCompilationUnit node) {
41
        return node.children(ASTImportDeclaration.class).count();
1✔
42
    }
43
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc