Checks for a duplicate import statements.
NOTE: This is a file-based rule, rather than a typical AST-based rule, so the applyToClassNames and doNotApplyToClassNames rule configuration properties are not available. See Standard Properties for Configuring Rules.
ImportFromSamePackage RuleChecks for an import of a class that is within the same package as the importing class.
NOTE: This is a file-based rule, rather than a typical AST-based rule, so the applyToClassNames and doNotApplyToClassNames rule configuration properties are not available. See Standard Properties for Configuring Rules.
ImportFromSunPackages RuleSince CodeNarc 0.14 Avoid importing anything from the ‘sun.*’ packages. These packages are not portable and are likely to change.
Example of violations:
import sun.misc.foo
import sun.misc.foo as Foo
public class MyClass{}
NOTE: This is a file-based rule, rather than a typical AST-based rule, so the applyToClassNames and doNotApplyToClassNames rule configuration properties are not available. See Standard Properties for Configuring Rules.
MisorderedStaticImports RuleSince CodeNarc 0.14 Checks for static import statements which should never be after nonstatic imports.
This rule has one property comesBefore
, which defaults to true. If you like your static imports to come after the others, then set this property to false.
Examples of violations:
import my.something.another
import static foo.bar
public class MyClass{}
NOTE: This is a file-based rule, rather than a typical AST-based rule, so the applyToClassNames and doNotApplyToClassNames rule configuration properties are not available. See Standard Properties for Configuring Rules.
NoWildcardImports RuleSince CodeNarc 0.21
Checks for wildcard (star) imports. If the ignoreStaticImports property is true, then do not check static imports. Similarly, do not check the standard imports if ignoreImports is true.
Example of violations:
import static foo.bar.* // violation (unless ignoreStaticImports is true)
import my.something.* // violation (unless ignoreImports is true)
public class MyClass{}
Property Description Default Value ignoreStaticImports If true, then do not check static imports. false
ignoreImports If true, then do not check imports. false
NOTE: This is a file-based rule, rather than a typical AST-based rule, so the applyToClassNames and doNotApplyToClassNames rule configuration properties are not available. See Standard Properties for Configuring Rules.
UnnecessaryGroovyImport RuleChecks for an import from any package that is already automatically imported for Groovy files. A Groovy file does not need to include an import for classes from java.lang, java.util, java.io, java.net, groovy.lang and groovy.util, as well as the classes java.math.BigDecimal and java.math.BigInteger.
NOTE: This is a file-based rule, rather than a typical AST-based rule, so the applyToClassNames and doNotApplyToClassNames rule configuration properties are not available. See Standard Properties for Configuring Rules.
UnusedImport RuleChecks for import statements for classes that are never referenced within the source file. Also checks static imports.
Known limitations:
import org.codenarc.*
)NOTE: This is a file-based rule, rather than a typical AST-based rule, so the applyToClassNames and doNotApplyToClassNames rule configuration properties are not available. See Standard Properties for Configuring Rules.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4