CodeNarc Report

Report title:Gradle-1.0-milestone-9
Date:Mar 23, 2012 5:46:40 PM
Generated with:CodeNarc v0.17

Summary by Package

PackageTotal FilesFiles with ViolationsPriority 1Priority 2Priority 3
All Packages258125-56389
src/org/gradle/api/internal1----
src/org/gradle/api/internal/artifacts/dsl11--4
src/org/gradle/api/internal/artifacts/dsl/dependencies22--3
src/org/gradle/api/internal/file43--4
src/org/gradle/api/internal/plugins1----
src/org/gradle/api/internal/project33--18
src/org/gradle/api/internal/tasks/compile31-11
src/org/gradle/api/internal/tasks/scala11-12
src/org/gradle/api/plugins75--13
src/org/gradle/api/plugins/announce3----
src/org/gradle/api/plugins/announce/internal126-77
src/org/gradle/api/plugins/osgi1----
src/org/gradle/api/plugins/quality197--25
src/org/gradle/api/plugins/quality/internal11-42
src/org/gradle/api/plugins/scala22-111
src/org/gradle/api/plugins/sonar2----
src/org/gradle/api/plugins/sonar/internal11--1
src/org/gradle/api/plugins/sonar/model42--2
src/org/gradle/api/publication42--3
src/org/gradle/api/publication/maven6----
src/org/gradle/api/publication/maven/internal11--2
src/org/gradle/api/publication/maven/internal/ant22--2
src/org/gradle/api/publication/maven/internal/model31--1
src/org/gradle/api/publication/maven/internal/modelbuilder2----
src/org/gradle/api/tasks2----
src/org/gradle/api/tasks/application11--20
src/org/gradle/api/tasks/bundling22--9
src/org/gradle/api/tasks/compile71--2
src/org/gradle/api/tasks/javadoc21--1
src/org/gradle/api/tasks/scala31-12
src/org/gradle/api/tasks/testing/testng11--4
src/org/gradle/api/tasks/util11-28
src/org/gradle/groovy/scripts22--12
src/org/gradle/initialization32--3
src/org/gradle/integtests/fixtures1715-3052
src/org/gradle/plugins/binaries/model/internal11--1
src/org/gradle/plugins/binaries/tasks1----
src/org/gradle/plugins/cpp3----
src/org/gradle/plugins/cpp/cdt1----
src/org/gradle/plugins/cpp/cdt/model41-1-
src/org/gradle/plugins/cpp/cdt/tasks1----
src/org/gradle/plugins/cpp/gpp32--8
src/org/gradle/plugins/cpp/msvcpp1----
src/org/gradle/plugins/ear22--4
src/org/gradle/plugins/ear/descriptor/internal42-22
src/org/gradle/plugins/ide/api3----
src/org/gradle/plugins/ide/eclipse72--11
src/org/gradle/plugins/ide/eclipse/internal2----
src/org/gradle/plugins/ide/eclipse/model2712--28
src/org/gradle/plugins/ide/eclipse/model/internal82--4
src/org/gradle/plugins/ide/idea43--3
src/org/gradle/plugins/ide/idea/internal1----
src/org/gradle/plugins/ide/idea/model1713--49
src/org/gradle/plugins/ide/idea/model/internal2----
src/org/gradle/plugins/ide/internal22-111
src/org/gradle/plugins/ide/internal/configurer31--3
src/org/gradle/plugins/ide/internal/generator32-22
src/org/gradle/plugins/signing74-128
src/org/gradle/plugins/signing/signatory3----
src/org/gradle/plugins/signing/signatory/pgp41--1
src/org/gradle/plugins/signing/type61--3
src/org/gradle/plugins/signing/type/pgp1----
src/org/gradle/profile11-1-
src/org/gradle/testing/internal/util1----
src/org/gradle/util85-117

Package: src.org.gradle.api.internal.artifacts.dsl

➥ DefaultArtifactHandler.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration335

[SRC]def DefaultArtifactHandler(ConfigurationContainer config..ctFactory) {

[MSG]Violation in class org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler. The def keyword is unneeded on constructors

UnnecessaryPackageReference340

[SRC]private PublishArtifact pushArtifact(org.gradle.api.arti..reClosure) {

[MSG]The org.gradle.api.artifacts.Configuration class was explicitly imported, so specifying the package name is not necessary

UnnecessaryDefInMethodDeclaration355

[SRC]public def methodMissing(String name, args) {

[MSG]Violation in class org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler. The def keyword is unneeded when a method is marked public

UnnecessaryGetter358

[SRC]if (!getMetaClass().respondsTo(this, name, args.size())) {

[MSG]Violation in class org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler. getMetaClass() can probably be rewritten as metaClass

Package: src.org.gradle.api.internal.artifacts.dsl.dependencies

➥ DefaultDependencyHandler.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration334

[SRC]def DefaultDependencyHandler(ConfigurationContainer conf..encyFactory,

[MSG]Violation in class org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. The def keyword is unneeded on constructors

UnnecessaryGetter393

[SRC]if (!getMetaClass().respondsTo(this, name, args.size())) {

[MSG]Violation in class org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. getMetaClass() can probably be rewritten as metaClass

➥ ModuleDescriptorDelegate.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration329

[SRC]def ModuleFactoryDelegate(ClientModule clientModule, Dep..cyFactory) {

[MSG]Violation in class org.gradle.api.internal.artifacts.dsl.dependencies.ModuleFactoryDelegate. The def keyword is unneeded on constructors

Package: src.org.gradle.api.internal.file

➥ AntFileCollectionBuilder.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryParenthesesForMethodCallWithClosure333

[SRC]node."${childNodeName ?: 'resources'}"() {

[MSG]Violation in class org.gradle.api.internal.file.AntFileCollectionBuilder. Parentheses in the 'null' method call are unnecessary and can be removed.

➥ AntFileCollectionMatchingTaskBuilder.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration324

[SRC]def AntFileCollectionMatchingTaskBuilder(Iterable<Direct..fileTrees) {

[MSG]Violation in class org.gradle.api.internal.file.AntFileCollectionMatchingTaskBuilder. The def keyword is unneeded on constructors

➥ AntFileTreeBuilder.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration324

[SRC]def AntFileTreeBuilder(Map<String, File> files) {

[MSG]Violation in class org.gradle.api.internal.file.AntFileTreeBuilder. The def keyword is unneeded on constructors

UnnecessaryParenthesesForMethodCallWithClosure329

[SRC]node."${childNodeName ?: 'resources'}"() {

[MSG]Violation in class org.gradle.api.internal.file.AntFileTreeBuilder. Parentheses in the 'null' method call are unnecessary and can be removed.

Package: src.org.gradle.api.internal.project

➥ DefaultAntBuilder.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration332

[SRC]def DefaultAntBuilder(Project gradleProject) {

[MSG]Violation in class org.gradle.api.internal.project.DefaultAntBuilder. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration336

[SRC]def Object invokeMethod(String methodName, Object args) {

[MSG]Violation in class org.gradle.api.internal.project.DefaultAntBuilder. The def keyword is unneeded when a method returns the Object type

UnnecessaryOverridingMethod336

[SRC]def Object invokeMethod(String methodName, Object args) {

[MSG]Violation in class DefaultAntBuilder. The method invokeMethod contains no logic and can be safely deleted

UnnecessaryDefInMethodDeclaration344

[SRC]private def doSetProperty(String property, newValue) {

[MSG]Violation in class org.gradle.api.internal.project.DefaultAntBuilder. The def keyword is unneeded when a method is marked private

UnnecessaryGetter375

[SRC]antProject.setUserProperty(MagicNames.ANT_FILE, file.get..olutePath())

[MSG]Violation in class org.gradle.api.internal.project.DefaultAntBuilder. getAbsolutePath() can probably be rewritten as absolutePath

➥ DefaultIsolatedAntBuilder.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration331

[SRC]def DefaultIsolatedAntBuilder(ClassPathRegistry classPat..erFactory) {

[MSG]Violation in class org.gradle.api.internal.project.DefaultIsolatedAntBuilder. The def keyword is unneeded on constructors

UnnecessaryDotClass3103

[SRC]Object antBuilder = gradleLoader.loadClass(BasicAntBuild..ewInstance()

[MSG]BasicAntBuilder.class can be rewritten as BasicAntBuilder

UnnecessaryDotClass3105

[SRC]Object antLogger = gradleLoader.loadClass(AntLoggingAdap..ewInstance()

[MSG]AntLoggingAdapter.class can be rewritten as AntLoggingAdapter

UnnecessaryGetter3106

[SRC]antBuilder.project.removeBuildListener(antBuilder.projec..teners()[0])

[MSG]Violation in class org.gradle.api.internal.project.DefaultIsolatedAntBuilder. getBuildListeners() can probably be rewritten as buildListeners

UnnecessaryDefInMethodDeclaration3124

[SRC]def AntBuilderDelegate(builder, antlibClassLoader) {

[MSG]Violation in class org.gradle.api.internal.project.AntBuilderDelegate. The def keyword is unneeded on constructors

➥ ProjectScript.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration329

[SRC]def void apply(Closure closure) {

[MSG]Violation in class org.gradle.api.internal.project.ProjectScript. The def keyword is unneeded when a method specifies a return type

UnnecessaryDefInMethodDeclaration333

[SRC]def void apply(Map options) {

[MSG]Violation in class org.gradle.api.internal.project.ProjectScript. The def keyword is unneeded when a method specifies a return type

UnnecessaryDefInMethodDeclaration337

[SRC]def ScriptHandler getBuildscript() {

[MSG]Violation in class org.gradle.api.internal.project.ProjectScript. The def keyword is unneeded when a method specifies a return type

UnnecessaryDefInMethodDeclaration341

[SRC]def void buildscript(Closure configureClosure) {

[MSG]Violation in class org.gradle.api.internal.project.ProjectScript. The def keyword is unneeded when a method specifies a return type

UnnecessaryDefInMethodDeclaration345

[SRC]def StandardOutputCapture getStandardOutputCapture() {

[MSG]Violation in class org.gradle.api.internal.project.ProjectScript. The def keyword is unneeded when a method specifies a return type

UnnecessaryDefInMethodDeclaration349

[SRC]def LoggingManager getLogging() {

[MSG]Violation in class org.gradle.api.internal.project.ProjectScript. The def keyword is unneeded when a method specifies a return type

UnnecessaryDefInMethodDeclaration353

[SRC]def Logger getLogger() {

[MSG]Violation in class org.gradle.api.internal.project.ProjectScript. The def keyword is unneeded when a method specifies a return type

UnnecessaryDefInMethodDeclaration357

[SRC]def String toString() {

[MSG]Violation in class org.gradle.api.internal.project.ProjectScript. The def keyword is unneeded when a method specifies a return type

Package: src.org.gradle.api.internal.tasks.compile

➥ AntGroovyCompiler.groovy

Rule NamePriorityLine #Source Line / Message
UnusedPrivateField235

[SRC]private static Logger logger = LoggerFactory.getLogger(A..ovyCompiler)

[MSG]The field logger is not used within the class org.gradle.api.internal.tasks.compile.AntGroovyCompiler

UnnecessaryDefInMethodDeclaration342

[SRC]def AntGroovyCompiler(IsolatedAntBuilder ant, ClassPathR..hRegistry) {

[MSG]Violation in class org.gradle.api.internal.tasks.compile.AntGroovyCompiler. The def keyword is unneeded on constructors

Package: src.org.gradle.api.internal.tasks.scala

➥ AntScalaCompiler.groovy

Rule NamePriorityLine #Source Line / Message
UnusedPrivateField227

[SRC]private static Logger logger = LoggerFactory.getLogger(A..alaCompiler)

[MSG]The field logger is not used within the class org.gradle.api.internal.tasks.scala.AntScalaCompiler

UnnecessaryDefInMethodDeclaration333

[SRC]def AntScalaCompiler(IsolatedAntBuilder antBuilder) {

[MSG]Violation in class org.gradle.api.internal.tasks.scala.AntScalaCompiler. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration339

[SRC]def AntScalaCompiler(IsolatedAntBuilder antBuilder, Iter..nsionDirs) {

[MSG]Violation in class org.gradle.api.internal.tasks.scala.AntScalaCompiler. The def keyword is unneeded on constructors

Package: src.org.gradle.api.plugins

➥ ApplicationPlugin.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryObjectReferences398

[SRC]installTask.doLast {

[MSG]The code could be more concise by using a with() or identity() block

➥ BasePlugin.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDotClass377

[SRC]Delete clean = project.tasks.add(CLEAN_TASK_NAME, Delete.class)

[MSG]Delete.class can be rewritten as Delete

UnnecessarySubstring392

[SRC]String targetTaskName = taskName.substring(prefix.length())

[MSG]Violation in class org.gradle.api.plugins.BasePlugin. The String.substring(int) method can be replaced with the subscript operator

UnnecessarySubstring3118

[SRC]Configuration configuration = project.configurations.fin...length())))

[MSG]Violation in class org.gradle.api.plugins.BasePlugin. The String.substring(int) method can be replaced with the subscript operator

UnnecessaryGetter3120

[SRC]project.tasks.add(taskName).dependsOn(configuration.getA..figuration))

[MSG]Violation in class org.gradle.api.plugins.BasePlugin. getAllArtifacts() can probably be rewritten as allArtifacts

UnnecessaryGetter3158

[SRC]Upload upload = project.getTasks().add(name, Upload.class)

[MSG]Violation in class org.gradle.api.plugins.BasePlugin. getTasks() can probably be rewritten as tasks

UnnecessaryDotClass3158

[SRC]Upload upload = project.getTasks().add(name, Upload.class)

[MSG]Upload.class can be rewritten as Upload

UnnecessaryGetter3161

[SRC]upload.descriptorDestination = new File(project.getBuild.., "ivy.xml")

[MSG]Violation in class org.gradle.api.plugins.BasePlugin. getBuildDir() can probably be rewritten as buildDir

UnnecessaryGetter3168

[SRC]ConfigurationContainer configurations = project.getConfigurations();

[MSG]Violation in class org.gradle.api.plugins.BasePlugin. getConfigurations() can probably be rewritten as configurations

➥ JavaPluginConvention.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDotClass374

[SRC]sourceSets = instantiator.newInstance(DefaultSourceSetCo..nstantiator)

[MSG]DefaultSourceSetContainer.class can be rewritten as DefaultSourceSetContainer

UnnecessaryGetter3185

[SRC]return ConfigureUtil.configure(closure, new DefaultManif..eResolver));

[MSG]Violation in class org.gradle.api.plugins.JavaPluginConvention. getProject() can probably be rewritten as project

➥ ProjectReportsPluginConvention.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration329

[SRC]def ProjectReportsPluginConvention(Project project) {

[MSG]Violation in class org.gradle.api.plugins.ProjectReportsPluginConvention. The def keyword is unneeded on constructors

➥ WarPluginConvention.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration327

[SRC]def WarPluginConvention(Project project) {

[MSG]Violation in class org.gradle.api.plugins.WarPluginConvention. The def keyword is unneeded on constructors

Package: src.org.gradle.api.plugins.announce.internal

➥ AnnouncingBuildListener.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter235

[SRC]void beforeExecute(Task task) {

[MSG]Violation in class AnnouncingBuildListener. Method parameter [task] is never referenced in the method beforeExecute of class org.gradle.api.plugins.announce.internal.AnnouncingBuildListener

UnnecessaryElseStatement373

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

➥ AppleScriptBackedGrowlAnnouncer.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration356

[SRC]private def escape(String value) {

[MSG]Violation in class org.gradle.api.plugins.announce.internal.AppleScriptBackedGrowlAnnouncer. The def keyword is unneeded when a method is marked private

➥ DefaultAnnouncerFactory.groovy

Rule NamePriorityLine #Source Line / Message
EmptyCatchBlock266

[SRC]} catch (ClassNotFoundException e) {

[MSG]The catch block is empty

UnusedMethodParameter278

[SRC]void send(String title, String message) {

[MSG]Violation in class UnknownAnnouncer. Method parameter [title] is never referenced in the method send of class org.gradle.api.plugins.announce.internal.UnknownAnnouncer

UnusedMethodParameter278

[SRC]void send(String title, String message) {

[MSG]Violation in class UnknownAnnouncer. Method parameter [message] is never referenced in the method send of class org.gradle.api.plugins.announce.internal.UnknownAnnouncer

UnnecessaryElseStatement351

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

UnnecessaryGetter365

[SRC]return getClass().getClassLoader().loadClass("org.gradle..conProvider)

[MSG]Violation in class org.gradle.api.plugins.announce.internal.DefaultAnnouncerFactory. getClassLoader() can probably be rewritten as classLoader

➥ GrowlNotifyBackedAnnouncer.groovy

Rule NamePriorityLine #Source Line / Message
UnusedPrivateMethod246

[SRC]private def escape(String value) {

[MSG]The method escape is not used within GrowlNotifyBackedAnnouncer.groovy

UnnecessaryDefInMethodDeclaration346

[SRC]private def escape(String value) {

[MSG]Violation in class org.gradle.api.plugins.announce.internal.GrowlNotifyBackedAnnouncer. The def keyword is unneeded when a method is marked private

➥ Snarl.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter343

[SRC]with(new PrintWriter(sock.getOutputStream(), true)) { out ->

[MSG]Violation in class org.gradle.api.plugins.announce.internal.Snarl. getOutputStream() can probably be rewritten as outputStream

UnnecessaryElseStatement366

[SRC]else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

➥ Twitter.groovy

Rule NamePriorityLine #Source Line / Message
ImportFromSunPackages220

[SRC]import sun.misc.BASE64Encoder

[MSG]The file imports sun.misc.BASE64Encoder, which is not portable and likely to change

UnusedMethodParameter240

[SRC]void send(String title, String message) {

[MSG]Violation in class Twitter. Method parameter [title] is never referenced in the method send of class org.gradle.api.plugins.announce.internal.Twitter

Package: src.org.gradle.api.plugins.quality

➥ Checkstyle.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter366

[SRC]getConfigProperties()

[MSG]Violation in class org.gradle.api.plugins.quality.Checkstyle. getConfigProperties() can probably be rewritten as configProperties

UnnecessaryGetter3144

[SRC]antBuilder.withClasspath(getCheckstyleClasspath()).execute {

[MSG]Violation in class org.gradle.api.plugins.quality.Checkstyle. getCheckstyleClasspath() can probably be rewritten as checkstyleClasspath

UnnecessaryGetter3147

[SRC]ant.checkstyle(config: getConfigFile(), failOnViolation:..pertyName) {

[MSG]Violation in class org.gradle.api.plugins.quality.Checkstyle. getConfigFile() can probably be rewritten as configFile

UnnecessaryGetter3148

[SRC]getSource().addToAntBuilder(ant, 'fileset', FileCollecti..ype.FileSet)

[MSG]Violation in class org.gradle.api.plugins.quality.Checkstyle. getSource() can probably be rewritten as source

UnnecessaryGetter3149

[SRC]getClasspath().addToAntBuilder(ant, 'classpath')

[MSG]Violation in class org.gradle.api.plugins.quality.Checkstyle. getClasspath() can probably be rewritten as classpath

UnnecessaryGetter3155

[SRC]getConfigProperties().each { key, value ->

[MSG]Violation in class org.gradle.api.plugins.quality.Checkstyle. getConfigProperties() can probably be rewritten as configProperties

UnnecessaryGetter3160

[SRC]if (!getIgnoreFailures() && ant.project.properties[propertyName]) {

[MSG]Violation in class org.gradle.api.plugins.quality.Checkstyle. getIgnoreFailures() can probably be rewritten as ignoreFailures

➥ CodeNarc.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter3102

[SRC]antBuilder.withClasspath(getCodenarcClasspath()).execute {

[MSG]Violation in class org.gradle.api.plugins.quality.CodeNarc. getCodenarcClasspath() can probably be rewritten as codenarcClasspath

UnnecessaryGetter3105

[SRC]ant.codenarc(ruleSetFiles: "file:${getConfigFile()}", ma..ations: 0) {

[MSG]Violation in class org.gradle.api.plugins.quality.CodeNarc. getConfigFile() can probably be rewritten as configFile

UnnecessaryGetter3116

[SRC]if (getIgnoreFailures()) {

[MSG]Violation in class org.gradle.api.plugins.quality.CodeNarc. getIgnoreFailures() can probably be rewritten as ignoreFailures

➥ FindBugs.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter3113

[SRC]antBuilder.withClasspath(getFindbugsClasspath()).execute {

[MSG]Violation in class org.gradle.api.plugins.quality.FindBugs. getFindbugsClasspath() can probably be rewritten as findbugsClasspath

UnnecessaryGetter3116

[SRC]getFindbugsClasspath().addToAntBuilder(ant, 'classpath')

[MSG]Violation in class org.gradle.api.plugins.quality.FindBugs. getFindbugsClasspath() can probably be rewritten as findbugsClasspath

UnnecessaryGetter3117

[SRC]getPluginClasspath().addToAntBuilder(ant, 'pluginList')

[MSG]Violation in class org.gradle.api.plugins.quality.FindBugs. getPluginClasspath() can probably be rewritten as pluginClasspath

UnnecessaryGetter3118

[SRC]getClasses().addToAntBuilder(ant, 'auxAnalyzepath')

[MSG]Violation in class org.gradle.api.plugins.quality.FindBugs. getClasses() can probably be rewritten as classes

UnnecessaryGetter3121

[SRC]addUnlessEmpty(ant, getClasspath(), 'auxClasspath')

[MSG]Violation in class org.gradle.api.plugins.quality.FindBugs. getClasspath() can probably be rewritten as classpath

UnnecessaryGetter3122

[SRC]addUnlessEmpty(ant, getSource(), 'sourcePath')

[MSG]Violation in class org.gradle.api.plugins.quality.FindBugs. getSource() can probably be rewritten as source

➥ GroovyCodeQualityPluginConvention.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration340

[SRC]def GroovyCodeQualityPluginConvention(Project project) {

[MSG]Violation in class org.gradle.api.plugins.quality.GroovyCodeQualityPluginConvention. The def keyword is unneeded on constructors

➥ JDepend.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter399

[SRC]antBuilder.withClasspath(getJdependClasspath()).execute {

[MSG]Violation in class org.gradle.api.plugins.quality.JDepend. getJdependClasspath() can probably be rewritten as jdependClasspath

UnnecessaryGetter3103

[SRC]pathElement(location: getClassesDir())

[MSG]Violation in class org.gradle.api.plugins.quality.JDepend. getClassesDir() can probably be rewritten as classesDir

➥ JavaCodeQualityPluginConvention.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration340

[SRC]def JavaCodeQualityPluginConvention(Project project) {

[MSG]Violation in class org.gradle.api.plugins.quality.JavaCodeQualityPluginConvention. The def keyword is unneeded on constructors

➥ Pmd.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter368

[SRC]antBuilder.withClasspath(getPmdClasspath()).execute {

[MSG]Violation in class org.gradle.api.plugins.quality.Pmd. getPmdClasspath() can probably be rewritten as pmdClasspath

UnnecessaryGetter370

[SRC]ant.pmd(failOnRuleViolation: !getIgnoreFailures()) {

[MSG]Violation in class org.gradle.api.plugins.quality.Pmd. getIgnoreFailures() can probably be rewritten as ignoreFailures

UnnecessaryGetter371

[SRC]getSource().addToAntBuilder(ant, 'fileset', FileCollecti..ype.FileSet)

[MSG]Violation in class org.gradle.api.plugins.quality.Pmd. getSource() can probably be rewritten as source

UnnecessaryGetter372

[SRC]getRuleSets().each {

[MSG]Violation in class org.gradle.api.plugins.quality.Pmd. getRuleSets() can probably be rewritten as ruleSets

UnnecessaryGetter375

[SRC]getRuleSetFiles().each {

[MSG]Violation in class org.gradle.api.plugins.quality.Pmd. getRuleSetFiles() can probably be rewritten as ruleSetFiles

Package: src.org.gradle.api.plugins.quality.internal

➥ AbstractCodeQualityPlugin.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter2106

[SRC]protected void configureTaskDefaults(T task, String baseName) {

[MSG]Violation in class AbstractCodeQualityPlugin. Method parameter [task] is never referenced in the method configureTaskDefaults of class org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin

UnusedMethodParameter2106

[SRC]protected void configureTaskDefaults(T task, String baseName) {

[MSG]Violation in class AbstractCodeQualityPlugin. Method parameter [baseName] is never referenced in the method configureTaskDefaults of class org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin

UnusedMethodParameter2118

[SRC]protected void configureForSourceSet(SourceSet sourceSet, T task) {

[MSG]Violation in class AbstractCodeQualityPlugin. Method parameter [sourceSet] is never referenced in the method configureForSourceSet of class org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin

UnusedMethodParameter2118

[SRC]protected void configureForSourceSet(SourceSet sourceSet, T task) {

[MSG]Violation in class AbstractCodeQualityPlugin. Method parameter [task] is never referenced in the method configureForSourceSet of class org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin

UnnecessarySubstring3101

[SRC]prunedName = prunedName[0].toLowerCase() + prunedName.substring(1)

[MSG]Violation in class org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin. The String.substring(int) method can be replaced with the subscript operator

UnnecessaryCollectCall3123

[SRC]project.tasks['check'].dependsOn { extension.sourceSets...me, null) }}

[MSG]Violation in class org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin. The call to collect could probably be rewritten as a spread expression: extension.sourceSets*.getTaskName(taskBaseName, null)

Package: src.org.gradle.api.plugins.scala

➥ ScalaBasePlugin.groovy

Rule NamePriorityLine #Source Line / Message
UnusedPrivateMethodParameter264

[SRC]private void configureCompileDefaults(final Project proj..avaPlugin) {

[MSG]Violation in class ScalaBasePlugin. Method parameter [javaPlugin] is never referenced in the method configureCompileDefaults of class org.gradle.api.plugins.scala.ScalaBasePlugin

UnnecessaryDotClass335

[SRC]JavaBasePlugin javaPlugin = project.plugins.apply(JavaBa..ugin.class);

[MSG]JavaBasePlugin.class can be rewritten as JavaBasePlugin

UnnecessaryDotClass346

[SRC]project.convention.getPlugin(JavaPluginConvention.class)..sourceSet ->

[MSG]JavaPluginConvention.class can be rewritten as JavaPluginConvention

UnnecessaryDotClass354

[SRC]ScalaCompile scalaCompile = project.tasks.add(taskName, ..pile.class);

[MSG]ScalaCompile.class can be rewritten as ScalaCompile

UnnecessaryDotClass365

[SRC]project.tasks.withType(ScalaCompile.class) {ScalaCompile compile ->

[MSG]ScalaCompile.class can be rewritten as ScalaCompile

UnnecessaryGetter371

[SRC]project.getTasks().withType(ScalaDoc.class) {ScalaDoc scalaDoc ->

[MSG]Violation in class org.gradle.api.plugins.scala.ScalaBasePlugin. getTasks() can probably be rewritten as tasks

UnnecessaryDotClass371

[SRC]project.getTasks().withType(ScalaDoc.class) {ScalaDoc scalaDoc ->

[MSG]ScalaDoc.class can be rewritten as ScalaDoc

➥ ScalaPlugin.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDotClass330

[SRC]project.plugins.apply(ScalaBasePlugin.class);

[MSG]ScalaBasePlugin.class can be rewritten as ScalaBasePlugin

UnnecessaryDotClass331

[SRC]project.plugins.apply(JavaPlugin.class);

[MSG]JavaPlugin.class can be rewritten as JavaPlugin

UnnecessaryGetter337

[SRC]project.getTasks().withType(ScalaDoc.class) {ScalaDoc scalaDoc ->

[MSG]Violation in class org.gradle.api.plugins.scala.ScalaPlugin. getTasks() can probably be rewritten as tasks

UnnecessaryDotClass337

[SRC]project.getTasks().withType(ScalaDoc.class) {ScalaDoc scalaDoc ->

[MSG]ScalaDoc.class can be rewritten as ScalaDoc

UnnecessaryDotClass341

[SRC]ScalaDoc scalaDoc = project.tasks.add(SCALA_DOC_TASK_NAM..laDoc.class)

[MSG]ScalaDoc.class can be rewritten as ScalaDoc

Package: src.org.gradle.api.plugins.sonar.internal

➥ SonarCodeAnalyzer.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryObjectReferences371

[SRC]projectDef.workDir = sonarProject.workDir

[MSG]The code could be more concise by using a with() or identity() block

Package: src.org.gradle.api.plugins.sonar.model

➥ IncludeProperties.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryPackageReference326

[SRC]public @interface IncludeProperties {}

[MSG]The java.lang.annotation.Annotation class was explicitly imported, so specifying the package name is not necessary

➥ SonarProperty.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryPackageReference326

[SRC]public @interface SonarProperty {

[MSG]The java.lang.annotation.Annotation class was explicitly imported, so specifying the package name is not necessary

Package: src.org.gradle.api.publication

➥ PublicationPlugin.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDotClass336

[SRC]project.task("publishArchives", dependsOn: 'assemble', t..ons.class) {

[MSG]PublishPublications.class can be rewritten as PublishPublications

UnnecessaryDotClass339

[SRC]project.task("installArchives", dependsOn: 'assemble', t..ons.class) {

[MSG]InstallPublications.class can be rewritten as InstallPublications

➥ Publications.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter327

[SRC]ConfigureUtil.configure(c, getMaven())

[MSG]Violation in class org.gradle.api.publication.Publications. getMaven() can probably be rewritten as maven

Package: src.org.gradle.api.publication.maven.internal

➥ MavenPublicationPomGenerator.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryObjectReferences344

[SRC]model.description = publication.description

[MSG]The code could be more concise by using a with() or identity() block

UnnecessaryObjectReferences355

[SRC]dependency.optional = mavenDep.optional

[MSG]The code could be more concise by using a with() or identity() block

Package: src.org.gradle.api.publication.maven.internal.ant

➥ DefaultGroovyMavenDeployer.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryElseStatement347

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

➥ DefaultMavenPublisher.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration355

[SRC]private def execute(MavenPublication publication, Instal..port task) {

[MSG]Violation in class org.gradle.api.publication.maven.internal.ant.DefaultMavenPublisher. The def keyword is unneeded when a method is marked private

Package: src.org.gradle.api.publication.maven.internal.model

➥ DefaultMavenPublication.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter342

[SRC]ConfigureUtil.configure(c, getRepository())

[MSG]Violation in class org.gradle.api.publication.maven.internal.model.DefaultMavenPublication. getRepository() can probably be rewritten as repository

Package: src.org.gradle.api.tasks.application

➥ CreateStartScripts.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter369

[SRC]if (!getApplicationName()) {

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getApplicationName() can probably be rewritten as applicationName

UnnecessaryGetter372

[SRC]return "${GUtil.toConstant(getApplicationName())}_OPTS"

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getApplicationName() can probably be rewritten as applicationName

UnnecessaryGetter380

[SRC]if (!getApplicationName()) {

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getApplicationName() can probably be rewritten as applicationName

UnnecessaryGetter383

[SRC]return "${GUtil.toConstant(getApplicationName())}_EXIT_CONSOLE"

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getApplicationName() can probably be rewritten as applicationName

UnnecessaryGetter388

[SRC]return new File(getOutputDir(), getApplicationName())

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getOutputDir() can probably be rewritten as outputDir

UnnecessaryGetter388

[SRC]return new File(getOutputDir(), getApplicationName())

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getApplicationName() can probably be rewritten as applicationName

UnnecessaryGetter393

[SRC]return new File(getOutputDir(), "${getApplicationName()}.bat")

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getOutputDir() can probably be rewritten as outputDir

UnnecessaryGetter393

[SRC]return new File(getOutputDir(), "${getApplicationName()}.bat")

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getApplicationName() can probably be rewritten as applicationName

UnnecessaryGetter398

[SRC]getOutputDir().mkdirs()

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getOutputDir() can probably be rewritten as outputDir

UnnecessaryGetter3101

[SRC]generator.applicationName = getApplicationName()

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getApplicationName() can probably be rewritten as applicationName

UnnecessaryGetter3102

[SRC]generator.mainClassName = getMainClassName()

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getMainClassName() can probably be rewritten as mainClassName

UnnecessaryGetter3103

[SRC]generator.optsEnvironmentVar = getOptsEnvironmentVar()

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getOptsEnvironmentVar() can probably be rewritten as optsEnvironmentVar

UnnecessaryGetter3104

[SRC]generator.exitEnvironmentVar = getExitEnvironmentVar()

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getExitEnvironmentVar() can probably be rewritten as exitEnvironmentVar

UnnecessaryGetter3105

[SRC]generator.classpath = getClasspath().collect { "lib/${it.name}" }

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getClasspath() can probably be rewritten as classpath

UnnecessaryGetter3106

[SRC]generator.scriptRelPath = "bin/${getUnixScript().name}"

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getUnixScript() can probably be rewritten as unixScript

UnnecessaryObjectReferences3106

[SRC]generator.scriptRelPath = "bin/${getUnixScript().name}"

[MSG]The code could be more concise by using a with() or identity() block

UnnecessaryGetter3107

[SRC]generator.generateUnixScript(getUnixScript())

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getUnixScript() can probably be rewritten as unixScript

UnnecessaryObjectReferences3107

[SRC]generator.generateUnixScript(getUnixScript())

[MSG]The code could be more concise by using a with() or identity() block

UnnecessaryGetter3108

[SRC]generator.generateWindowsScript(getWindowsScript())

[MSG]Violation in class org.gradle.api.tasks.application.CreateStartScripts. getWindowsScript() can probably be rewritten as windowsScript

UnnecessaryObjectReferences3108

[SRC]generator.generateWindowsScript(getWindowsScript())

[MSG]The code could be more concise by using a with() or identity() block

Package: src.org.gradle.api.tasks.bundling

➥ Jar.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter347

[SRC]Manifest manifest = getManifest() ?: new DefaultManifest(null)

[MSG]Violation in class org.gradle.api.tasks.bundling.Jar. getManifest() can probably be rewritten as manifest

UnnecessaryGetter386

[SRC]if (getManifest() == null) {

[MSG]Violation in class org.gradle.api.tasks.bundling.Jar. getManifest() can probably be rewritten as manifest

UnnecessaryGetter389

[SRC]ConfigureUtil.configure(configureClosure, getManifest());

[MSG]Violation in class org.gradle.api.tasks.bundling.Jar. getManifest() can probably be rewritten as manifest

UnnecessaryGetter3107

[SRC]return ConfigureUtil.configure(configureClosure, getMetaInf())

[MSG]Violation in class org.gradle.api.tasks.bundling.Jar. getMetaInf() can probably be rewritten as metaInf

➥ War.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter346

[SRC]def classpath = getClasspath()

[MSG]Violation in class org.gradle.api.tasks.bundling.War. getClasspath() can probably be rewritten as classpath

UnnecessaryGetter352

[SRC]def classpath = getClasspath()

[MSG]Violation in class org.gradle.api.tasks.bundling.War. getClasspath() can probably be rewritten as classpath

UnnecessaryGetter358

[SRC]getWebXml()

[MSG]Violation in class org.gradle.api.tasks.bundling.War. getWebXml() can probably be rewritten as webXml

UnnecessaryGetter380

[SRC]return ConfigureUtil.configure(configureClosure, getWebInf())

[MSG]Violation in class org.gradle.api.tasks.bundling.War. getWebInf() can probably be rewritten as webInf

UnnecessaryGetter3110

[SRC]FileCollection oldClasspath = getClasspath()

[MSG]Violation in class org.gradle.api.tasks.bundling.War. getClasspath() can probably be rewritten as classpath

Package: src.org.gradle.api.tasks.compile

➥ AbstractOptions.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter348

[SRC]((field.getModifiers() & Modifier.STATIC) == 0) &&

[MSG]Violation in class org.gradle.api.tasks.compile.AbstractOptions. getModifiers() can probably be rewritten as modifiers

UnnecessaryGetter349

[SRC](field.getName() != "metaClass") &&

[MSG]Violation in class org.gradle.api.tasks.compile.AbstractOptions. getName() can probably be rewritten as name

Package: src.org.gradle.api.tasks.javadoc

➥ AntGroovydoc.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration331

[SRC]def AntGroovydoc(IsolatedAntBuilder ant, ClassPathRegist..hRegistry) {

[MSG]Violation in class org.gradle.api.tasks.javadoc.AntGroovydoc. The def keyword is unneeded on constructors

Package: src.org.gradle.api.tasks.scala

➥ AntScalaDoc.groovy

Rule NamePriorityLine #Source Line / Message
UnusedPrivateField224

[SRC]private static Logger logger = LoggerFactory.getLogger(AntScalaDoc)

[MSG]The field logger is not used within the class org.gradle.api.tasks.scala.AntScalaDoc

UnnecessaryDefInMethodDeclaration330

[SRC]def AntScalaDoc(IsolatedAntBuilder antBuilder) {

[MSG]Violation in class org.gradle.api.tasks.scala.AntScalaDoc. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration336

[SRC]def AntScalaDoc(IsolatedAntBuilder antBuilder, Iterable<..nsionDirs) {

[MSG]Violation in class org.gradle.api.tasks.scala.AntScalaDoc. The def keyword is unneeded on constructors

Package: src.org.gradle.api.tasks.testing.testng

➥ TestNGOptions.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter3194

[SRC]return suiteXmlBuilder.getMetaClass()."${name}"

[MSG]Violation in class org.gradle.api.tasks.testing.testng.TestNGOptions. getMetaClass() can probably be rewritten as metaClass

UnnecessaryElseStatement3195

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

UnnecessaryGetter3202

[SRC]return suiteXmlBuilder.getMetaClass().invokeMethod(suite.. name, args)

[MSG]Violation in class org.gradle.api.tasks.testing.testng.TestNGOptions. getMetaClass() can probably be rewritten as metaClass

UnnecessaryElseStatement3203

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

Package: src.org.gradle.api.tasks.util

➥ PatternSet.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter2206

[SRC]def addToAntBuilder(node, String childNodeName = null) {

[MSG]Violation in class PatternSet. Method parameter [childNodeName] is never referenced in the method addToAntBuilder of class org.gradle.api.tasks.util.PatternSet

UnusedMethodParameter2242

[SRC]def addToAntBuilder(Object node, String childNodeName) {

[MSG]Violation in class IntersectionPatternSet. Method parameter [childNodeName] is never referenced in the method addToAntBuilder of class org.gradle.api.tasks.util.IntersectionPatternSet

UnnecessaryDefInFieldDeclaration351

[SRC]def boolean caseSensitive = true

[MSG]Violation in class org.gradle.api.tasks.util.PatternSet. The def keyword is unneeded when a field type is specified

UnnecessaryDefInMethodDeclaration357

[SRC]static def setGlobalExcludes(Collection<String> excludes) {

[MSG]Violation in class org.gradle.api.tasks.util.PatternSet. The def keyword is unneeded when a method is marked static

UnnecessaryDefInMethodDeclaration362

[SRC]static def resetGlobalExcludes() {

[MSG]Violation in class org.gradle.api.tasks.util.PatternSet. The def keyword is unneeded when a method is marked static

UnnecessaryDefInMethodDeclaration366

[SRC]def boolean equals(Object o) {

[MSG]Violation in class org.gradle.api.tasks.util.PatternSet. The def keyword is unneeded when a method specifies a return type

UnnecessaryDefInMethodDeclaration376

[SRC]def int hashCode() {

[MSG]Violation in class org.gradle.api.tasks.util.PatternSet. The def keyword is unneeded when a method specifies a return type

UnnecessaryDefInMethodDeclaration3234

[SRC]def IntersectionPatternSet(PatternSet other) {

[MSG]Violation in class org.gradle.api.tasks.util.IntersectionPatternSet. The def keyword is unneeded on constructors

UnnecessaryGetter3239

[SRC]return new AndSpec<FileTreeElement>([super.getAsSpec(), ..] as Spec[])

[MSG]Violation in class org.gradle.api.tasks.util.IntersectionPatternSet. getAsSpec() can probably be rewritten as asSpec

UnnecessaryGetter3239

[SRC]return new AndSpec<FileTreeElement>([super.getAsSpec(), ..] as Spec[])

[MSG]Violation in class org.gradle.api.tasks.util.IntersectionPatternSet. getAsSpec() can probably be rewritten as asSpec

Package: src.org.gradle.groovy.scripts

➥ BasicScript.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDotClass334

[SRC]standardOutputCapture = services.get(StandardOutputCapture.class)

[MSG]StandardOutputCapture.class can be rewritten as StandardOutputCapture

UnnecessaryDefInMethodDeclaration338

[SRC]def Object getScriptTarget() {

[MSG]Violation in class org.gradle.groovy.scripts.BasicScript. The def keyword is unneeded when a method returns the Object type

UnnecessaryDefInMethodDeclaration342

[SRC]def StandardOutputCapture getStandardOutputCapture() {

[MSG]Violation in class org.gradle.groovy.scripts.BasicScript. The def keyword is unneeded when a method specifies a return type

UnnecessaryGetter365

[SRC]return target.getProperties()

[MSG]Violation in class org.gradle.groovy.scripts.BasicScript. getProperties() can probably be rewritten as properties

➥ DefaultScript.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDotClass343

[SRC]private static final Logger LOGGER = Logging.getLogger(Script.class)

[MSG]Script.class can be rewritten as Script

UnnecessaryDefInMethodDeclaration349

[SRC]def void init(Object target, ServiceRegistry services) {

[MSG]Violation in class org.gradle.groovy.scripts.DefaultScript. The def keyword is unneeded when a method specifies a return type

UnnecessaryDotClass352

[SRC]loggingManager = services.get(LoggingManager.class)

[MSG]LoggingManager.class can be rewritten as LoggingManager

UnnecessaryDotClass368

[SRC]ObjectConfigurationAction action = new DefaultObjectConf..criptTarget)

[MSG]ScriptPluginFactory.class can be rewritten as ScriptPluginFactory

UnnecessaryDotClass374

[SRC]ObjectConfigurationAction action = new DefaultObjectConf..criptTarget)

[MSG]ScriptPluginFactory.class can be rewritten as ScriptPluginFactory

UnnecessaryDotClass380

[SRC]return services.get(ScriptHandler.class);

[MSG]ScriptHandler.class can be rewritten as ScriptHandler

UnnecessaryGetter384

[SRC]ConfigureUtil.configure(configureClosure, getBuildscript())

[MSG]Violation in class org.gradle.groovy.scripts.DefaultScript. getBuildscript() can probably be rewritten as buildscript

UnnecessaryDefInMethodDeclaration3172

[SRC]def String toString() {

[MSG]Violation in class org.gradle.groovy.scripts.DefaultScript. The def keyword is unneeded when a method specifies a return type

Package: src.org.gradle.initialization

➥ InitScript.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter323

[SRC]getBuildscript()

[MSG]Violation in class org.gradle.initialization.InitScript. getBuildscript() can probably be rewritten as buildscript

UnnecessaryDefInMethodDeclaration330

[SRC]def String toString() {

[MSG]Violation in class org.gradle.initialization.InitScript. The def keyword is unneeded when a method specifies a return type

➥ SettingsScript.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration321

[SRC]def String toString() {

[MSG]Violation in class org.gradle.initialization.SettingsScript. The def keyword is unneeded when a method specifies a return type

Package: src.org.gradle.integtests.fixtures

➥ AbstractAutoTestedSamplesTest.groovy

Rule NamePriorityLine #Source Line / Message
JUnitPublicNonTestMethod226

[SRC]void runSamplesFrom(String dir) {

[MSG]Violation in class AbstractAutoTestedSamplesTest. The method runSamplesFrom is public but not a test method

JUnitPublicNonTestMethod241

[SRC]void includeOnly(String includes) {

[MSG]Violation in class AbstractAutoTestedSamplesTest. The method includeOnly is public but not a test method

➥ AbstractIntegrationSpec.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter344

[SRC]distribution.getTestDir();

[MSG]Violation in class org.gradle.integtests.fixtures.AbstractIntegrationSpec. getTestDir() can probably be rewritten as testDir

UnnecessaryGetter348

[SRC]getTestDir().file(path);

[MSG]Violation in class org.gradle.integtests.fixtures.AbstractIntegrationSpec. getTestDir() can probably be rewritten as testDir

UnnecessaryGetter3130

[SRC]executer.withUserHomeDir(distribution.getUserHomeDir())

[MSG]Violation in class org.gradle.integtests.fixtures.AbstractIntegrationSpec. getUserHomeDir() can probably be rewritten as userHomeDir

UnnecessaryGetter3131

[SRC]return new GradleBackedArtifactBuilder(executer, getTest..artifacts"))

[MSG]Violation in class org.gradle.integtests.fixtures.AbstractIntegrationSpec. getTestDir() can probably be rewritten as testDir

➥ AutoTestedSamplesUtil.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryParenthesesForMethodCallWithClosure334

[SRC]list.each() { runSamplesFromFile(it, runner) }

[MSG]Violation in class org.gradle.integtests.fixtures.AutoTestedSamplesUtil. Parentheses in the 'each' method call are unnecessary and can be removed.

➥ CrossVersionIntegrationSpec.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter337

[SRC]current.getTestDir();

[MSG]Violation in class org.gradle.integtests.fixtures.CrossVersionIntegrationSpec. getTestDir() can probably be rewritten as testDir

➥ CrossVersionTestRunner.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessarySubstring368

[SRC]def minVersion = targetGradleVersion.substring(0, target..ength() - 1)

[MSG]Violation in class org.gradle.integtests.fixtures.CrossVersionTestRunner$PreviousVersionExecution. The String.substring(int, int) method can be replaced with the subscript operator

➥ HttpServer.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter2338

[SRC]boolean reauthenticate(Principal user) {

[MSG]Violation in class HttpServer$TestUserRealm. Method parameter [user] is never referenced in the method reauthenticate of class org.gradle.integtests.fixtures.HttpServer$TestUserRealm

UnusedMethodParameter2342

[SRC]boolean isUserInRole(Principal user, String role) {

[MSG]Violation in class HttpServer$TestUserRealm. Method parameter [user] is never referenced in the method isUserInRole of class org.gradle.integtests.fixtures.HttpServer$TestUserRealm

UnusedMethodParameter2342

[SRC]boolean isUserInRole(Principal user, String role) {

[MSG]Violation in class HttpServer$TestUserRealm. Method parameter [role] is never referenced in the method isUserInRole of class org.gradle.integtests.fixtures.HttpServer$TestUserRealm

EmptyMethod2346

[SRC]void disassociate(Principal user) {

[MSG]Violation in class HttpServer$TestUserRealm. The method disassociate is both empty and not marked with @Override

UnusedMethodParameter2346

[SRC]void disassociate(Principal user) {

[MSG]Violation in class HttpServer$TestUserRealm. Method parameter [user] is never referenced in the method disassociate of class org.gradle.integtests.fixtures.HttpServer$TestUserRealm

UnusedMethodParameter2349

[SRC]Principal pushRole(Principal user, String role) {

[MSG]Violation in class HttpServer$TestUserRealm. Method parameter [role] is never referenced in the method pushRole of class org.gradle.integtests.fixtures.HttpServer$TestUserRealm

EmptyMethod2357

[SRC]void logout(Principal user) {

[MSG]Violation in class HttpServer$TestUserRealm. The method logout is both empty and not marked with @Override

UnusedMethodParameter2357

[SRC]void logout(Principal user) {

[MSG]Violation in class HttpServer$TestUserRealm. Method parameter [user] is never referenced in the method logout of class org.gradle.integtests.fixtures.HttpServer$TestUserRealm

UnnecessaryDotClass331

[SRC]private static Logger logger = LoggerFactory.getLogger(H..erver.class)

[MSG]HttpServer.class can be rewritten as HttpServer

UnnecessarySubstring393

[SRC]def relativePath = request.pathInfo.substring(path.length() + 1)

[MSG]Violation in class org.gradle.integtests.fixtures.HttpServer$3. The String.substring(int) method can be replaced with the subscript operator

➥ JUnitTestExecutionResult.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter2100

[SRC]TestClassExecutionResult assertTestSkipped(String name) {

[MSG]Violation in class JUnitTestClassExecutionResult. Method parameter [name] is never referenced in the method assertTestSkipped of class org.gradle.integtests.fixtures.JUnitTestClassExecutionResult

UnusedMethodParameter2110

[SRC]TestClassExecutionResult assertConfigMethodPassed(String name) {

[MSG]Violation in class JUnitTestClassExecutionResult. Method parameter [name] is never referenced in the method assertConfigMethodPassed of class org.gradle.integtests.fixtures.JUnitTestClassExecutionResult

UnusedMethodParameter2114

[SRC]TestClassExecutionResult assertConfigMethodFailed(String name) {

[MSG]Violation in class JUnitTestClassExecutionResult. Method parameter [name] is never referenced in the method assertConfigMethodFailed of class org.gradle.integtests.fixtures.JUnitTestClassExecutionResult

MisorderedStaticImports321

[SRC]import static org.hamcrest.Matchers.*

[MSG]Static imports should appear before normal imports

MisorderedStaticImports322

[SRC]import static org.junit.Assert.assertThat

[MSG]Static imports should appear before normal imports

UnnecessaryDefInMethodDeclaration327

[SRC]def JUnitTestExecutionResult(TestFile projectDir, String..= 'build') {

[MSG]Violation in class org.gradle.integtests.fixtures.JUnitTestExecutionResult. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration341

[SRC]private def findTestClass(String testClass) {

[MSG]Violation in class org.gradle.integtests.fixtures.JUnitTestExecutionResult. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration349

[SRC]private def findClasses() {

[MSG]Violation in class org.gradle.integtests.fixtures.JUnitTestExecutionResult. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration369

[SRC]def JUnitTestClassExecutionResult(GPathResult testClassN..ClassName) {

[MSG]Violation in class org.gradle.integtests.fixtures.JUnitTestClassExecutionResult. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration3130

[SRC]private def findTests() {

[MSG]Violation in class org.gradle.integtests.fixtures.JUnitTestClassExecutionResult. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3160

[SRC]private def findIgnoredTests() {

[MSG]Violation in class org.gradle.integtests.fixtures.JUnitTestClassExecutionResult. The def keyword is unneeded when a method is marked private

➥ MavenRepository.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryCollectCall3106

[SRC]artifactNames = names.collect { it.replace('-SNAPSHOT', ..-${build}")}

[MSG]Violation in class org.gradle.integtests.fixtures.MavenModule. The call to collect could probably be rewritten as a spread expression: names*.replace(-SNAPSHOT, -$timestamp-$build)

UnnecessaryCollectCall3283

[SRC]assert dependencies.collect { it.artifactId} as Set == a..ctIds as Set

[MSG]Violation in class org.gradle.integtests.fixtures.MavenScope. The call to collect could probably be rewritten as a spread expression: dependencies*.artifactId

➥ PreviousGradleVersionExecuter.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration360

[SRC]def String toString() {

[MSG]Violation in class org.gradle.integtests.fixtures.PreviousGradleVersionExecuter. The def keyword is unneeded when a method specifies a return type

UnnecessaryElseStatement3102

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

UnnecessaryDefInMethodDeclaration3158

[SRC]def TestFile getGradleHomeDir() {

[MSG]Violation in class org.gradle.integtests.fixtures.PreviousGradleVersionExecuter. The def keyword is unneeded when a method specifies a return type

➥ SFTPServer.groovy

Rule NamePriorityLine #Source Line / Message
EmptyCatchBlock270

[SRC]} catch (Throwable e) {}

[MSG]The catch block is empty

EmptyCatchBlock273

[SRC]} catch (Throwable e) {}

[MSG]The catch block is empty

EmptyCatchBlock277

[SRC]} catch (Throwable e) {}

[MSG]The catch block is empty

EmptyMethod2105

[SRC]public void showMessage(String message) {

[MSG]Violation in class SFTPServer$1. The method showMessage is both empty and not marked with @Override

UnusedMethodParameter2128

[SRC]boolean authenticate(String username, PublicKey key, Ser..n session) {

[MSG]Violation in class SFTPServer$3. Method parameter [username] is never referenced in the method authenticate of class org.gradle.integtests.fixtures.SFTPServer$3

UnusedMethodParameter2128

[SRC]boolean authenticate(String username, PublicKey key, Ser..n session) {

[MSG]Violation in class SFTPServer$3. Method parameter [key] is never referenced in the method authenticate of class org.gradle.integtests.fixtures.SFTPServer$3

UnusedMethodParameter2128

[SRC]boolean authenticate(String username, PublicKey key, Ser..n session) {

[MSG]Violation in class SFTPServer$3. Method parameter [session] is never referenced in the method authenticate of class org.gradle.integtests.fixtures.SFTPServer$3

UnusedMethodParameter2160

[SRC]boolean authenticate(String username, String password, o..n session) {

[MSG]Violation in class DummyPasswordAuthenticator. Method parameter [session] is never referenced in the method authenticate of class org.gradle.integtests.fixtures.DummyPasswordAuthenticator

UnnecessaryGetter3114

[SRC]FileUtils.copyURLToFile(fileUrl, new File(configDir.getR..-dsa.key"));

[MSG]Violation in class org.gradle.integtests.fixtures.SFTPServer. getRoot() can probably be rewritten as root

UnnecessaryGetter3118

[SRC]sshServer.setFileSystemFactory(new TestNativeFileSystemF..stLogger() {

[MSG]Violation in class org.gradle.integtests.fixtures.SFTPServer. getRoot() can probably be rewritten as root

UnnecessaryGetter3125

[SRC]sshServer.setKeyPairProvider(new SimpleGeneratorHostKeyP..-dsa.key"));

[MSG]Violation in class org.gradle.integtests.fixtures.SFTPServer. getRoot() can probably be rewritten as root

UnnecessaryObjectReferences3126

[SRC]sshServer.setPasswordAuthenticator(new DummyPasswordAuthenticator());

[MSG]The code could be more concise by using a with() or identity() block

UnnecessaryObjectReferences3127

[SRC]sshServer.setPublickeyAuthenticator(new PublickeyAuthenticator() {

[MSG]The code could be more concise by using a with() or identity() block

UnnecessaryGetter3136

[SRC]new File(baseDir.getRoot(), filePathToCheck).exists()

[MSG]Violation in class org.gradle.integtests.fixtures.SFTPServer. getRoot() can probably be rewritten as root

UnnecessaryGetter3140

[SRC]new TestFile(new File(baseDir.getRoot(), expectedPath))

[MSG]Violation in class org.gradle.integtests.fixtures.SFTPServer. getRoot() can probably be rewritten as root

UnnecessaryPackageReference3160

[SRC]boolean authenticate(String username, String password, o..n session) {

[MSG]The org.apache.sshd.server.session.ServerSession class was explicitly imported, so specifying the package name is not necessary

➥ TestNGExecutionResult.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter284

[SRC]TestClassExecutionResult assertTestsSkipped(String... testNames) {

[MSG]Violation in class TestNgTestClassExecutionResult. Method parameter [testNames] is never referenced in the method assertTestsSkipped of class org.gradle.integtests.fixtures.TestNgTestClassExecutionResult

UnusedMethodParameter2107

[SRC]TestClassExecutionResult assertStdout(Matcher<? super St..> matcher) {

[MSG]Violation in class TestNgTestClassExecutionResult. Method parameter [matcher] is never referenced in the method assertStdout of class org.gradle.integtests.fixtures.TestNgTestClassExecutionResult

UnusedMethodParameter2111

[SRC]TestClassExecutionResult assertStderr(Matcher<? super St..> matcher) {

[MSG]Violation in class TestNgTestClassExecutionResult. Method parameter [matcher] is never referenced in the method assertStderr of class org.gradle.integtests.fixtures.TestNgTestClassExecutionResult

UnnecessaryDefInMethodDeclaration330

[SRC]def TestNGExecutionResult(projectDir) {

[MSG]Violation in class org.gradle.integtests.fixtures.TestNGExecutionResult. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration346

[SRC]private def findTestClass(String testClass) {

[MSG]Violation in class org.gradle.integtests.fixtures.TestNGExecutionResult. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration354

[SRC]private def findTestClasses() {

[MSG]Violation in class org.gradle.integtests.fixtures.TestNGExecutionResult. The def keyword is unneeded when a method is marked private

UnnecessaryDefInFieldDeclaration364

[SRC]def String testClass

[MSG]Violation in class org.gradle.integtests.fixtures.TestNgTestClassExecutionResult. The def keyword is unneeded when a field type is specified

UnnecessaryDefInFieldDeclaration365

[SRC]def GPathResult testClassNode

[MSG]Violation in class org.gradle.integtests.fixtures.TestNgTestClassExecutionResult. The def keyword is unneeded when a field type is specified

UnnecessaryDefInMethodDeclaration367

[SRC]def TestNgTestClassExecutionResult(String testClass, GPa..resultXml) {

[MSG]Violation in class org.gradle.integtests.fixtures.TestNgTestClassExecutionResult. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration3127

[SRC]private def findConfigMethod(String testName) {

[MSG]Violation in class org.gradle.integtests.fixtures.TestNgTestClassExecutionResult. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3135

[SRC]private def findConfigMethods() {

[MSG]Violation in class org.gradle.integtests.fixtures.TestNgTestClassExecutionResult. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3143

[SRC]private def findTestMethod(String testName) {

[MSG]Violation in class org.gradle.integtests.fixtures.TestNgTestClassExecutionResult. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3151

[SRC]private def findTestMethods() {

[MSG]Violation in class org.gradle.integtests.fixtures.TestNgTestClassExecutionResult. The def keyword is unneeded when a method is marked private

➥ TestNativeFileSystem.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter367

[SRC]return getFile(baseDir.getAbsolutePath(), file);

[MSG]Violation in class org.gradle.integtests.fixtures.TestNativeFileSystemView. getAbsolutePath() can probably be rewritten as absolutePath

UnnecessarySubstring377

[SRC]String userFileName = physicalName.substring("/".length() - 1);

[MSG]Violation in class org.gradle.integtests.fixtures.TestNativeFileSystemView. The String.substring(int) method can be replaced with the subscript operator

UnnecessaryGetter3107

[SRC]String userName = session.getUsername();

[MSG]Violation in class org.gradle.integtests.fixtures.TestNativeFileSystemFactory. getUsername() can probably be rewritten as username

➥ TestProxyServer.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter251

[SRC]void filter(HttpRequest httpRequest) {

[MSG]Violation in class TestProxyServer$1. Method parameter [httpRequest] is never referenced in the method filter of class org.gradle.integtests.fixtures.TestProxyServer$1

➥ UserGuideSamplesRunner.groovy

Rule NamePriorityLine #Source Line / Message
EmptyIfStatement2176

[SRC]if (line.matches('Download .+')) {

[MSG]The if statement is empty

UnnecessaryDefInMethodDeclaration342

[SRC]def UserGuideSamplesRunner(Class<?> testClass) {

[MSG]Violation in class org.gradle.integtests.fixtures.UserGuideSamplesRunner. The def keyword is unneeded on constructors

UnnecessaryGetter345

[SRC]this.dirFilter = getDirFilterPattern()

[MSG]Violation in class org.gradle.integtests.fixtures.UserGuideSamplesRunner. getDirFilterPattern() can probably be rewritten as dirFilterPattern

UnnecessaryDefInMethodDeclaration388

[SRC]private def cleanup(SampleRun run) {

[MSG]Violation in class org.gradle.integtests.fixtures.UserGuideSamplesRunner. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration399

[SRC]private def runSample(GradleRun run) {

[MSG]Violation in class org.gradle.integtests.fixtures.UserGuideSamplesRunner. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3138

[SRC]private def compareStrings(String expected, String actua..xtraLines) {

[MSG]Violation in class org.gradle.integtests.fixtures.UserGuideSamplesRunner. The def keyword is unneeded when a method is marked private

UnnecessaryPackageReference3197

[SRC]actual = actual.replaceAll(java.util.regex.Pattern.quote..le/samples')

[MSG]The java.util.regex.Pattern class was explicitly imported, so specifying the package name is not necessary

UnnecessaryPackageReference3199

[SRC]actual = actual.replaceAll(java.util.regex.Pattern.quote..rator), '/')

[MSG]The java.util.regex.Pattern class was explicitly imported, so specifying the package name is not necessary

➥ WellBehavedPluginTest.groovy

Rule NamePriorityLine #Source Line / Message
JUnitPublicNonTestMethod223

[SRC]String getPluginId() {

[MSG]Violation in class WellBehavedPluginTest. The method getPluginId is public but not a test method

JUnitPublicNonTestMethod231

[SRC]String getMainTask() {

[MSG]Violation in class WellBehavedPluginTest. The method getMainTask is public but not a test method

JUnitPublicNonTestMethod235

[SRC]def "plugin does not force creation of build dir during ..uration"() {

[MSG]Violation in class WellBehavedPluginTest. The method plugin does not force creation of build dir during configuration is public but not a test method

JUnitPublicNonTestMethod246

[SRC]def "plugin can build with empty project"() {

[MSG]Violation in class WellBehavedPluginTest. The method plugin can build with empty project is public but not a test method

UnnecessaryGetter337

[SRC]buildFile << "apply plugin: '${getPluginId()}'"

[MSG]Violation in class org.gradle.integtests.fixtures.WellBehavedPluginTest. getPluginId() can probably be rewritten as pluginId

UnnecessaryGetter348

[SRC]buildFile << "apply plugin: '${getPluginId()}'"

[MSG]Violation in class org.gradle.integtests.fixtures.WellBehavedPluginTest. getPluginId() can probably be rewritten as pluginId

Package: src.org.gradle.plugins.binaries.model.internal

➥ ConfigurationBasedNativeDependencySet.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter350

[SRC]def headersConfiguration = getHeadersConfiguration()

[MSG]Violation in class org.gradle.plugins.binaries.model.internal.ConfigurationBasedNativeDependencySet. getHeadersConfiguration() can probably be rewritten as headersConfiguration

Package: src.org.gradle.plugins.cpp.cdt.model

➥ CprojectDescriptor.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter2109

[SRC]protected void store(Node xml) {

[MSG]Violation in class CprojectDescriptor. Method parameter [xml] is never referenced in the method store of class org.gradle.plugins.cpp.cdt.model.CprojectDescriptor

Package: src.org.gradle.plugins.cpp.gpp

➥ GppCompileSpec.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter367

[SRC]task.outputs.file { getOutputFile() }

[MSG]Violation in class org.gradle.plugins.cpp.gpp.GppCompileSpec. getOutputFile() can probably be rewritten as outputFile

UnnecessaryGetter3143

[SRC]project.file "$project.buildDir/binaries/${getOutputFileName()}"

[MSG]Violation in class org.gradle.plugins.cpp.gpp.GppCompileSpec. getOutputFileName() can probably be rewritten as outputFileName

UnnecessaryGetter3150

[SRC]return "${getBaseName()}.${extension}"

[MSG]Violation in class org.gradle.plugins.cpp.gpp.GppCompileSpec. getBaseName() can probably be rewritten as baseName

UnnecessaryElseStatement3151

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

UnnecessaryGetter3152

[SRC]return getDefaultOutputFileName()

[MSG]Violation in class org.gradle.plugins.cpp.gpp.GppCompileSpec. getDefaultOutputFileName() can probably be rewritten as defaultOutputFileName

UnnecessaryGetter3157

[SRC]return OperatingSystem.current().getExecutableName(getBaseName())

[MSG]Violation in class org.gradle.plugins.cpp.gpp.GppCompileSpec. getBaseName() can probably be rewritten as baseName

➥ GppLibraryCompileSpec.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter334

[SRC]return OperatingSystem.current().getSharedLibraryName(getBaseName())

[MSG]Violation in class org.gradle.plugins.cpp.gpp.GppLibraryCompileSpec. getBaseName() can probably be rewritten as baseName

UnnecessaryGetter338

[SRC]return installName ?: getOutputFileName()

[MSG]Violation in class org.gradle.plugins.cpp.gpp.GppLibraryCompileSpec. getOutputFileName() can probably be rewritten as outputFileName

Package: src.org.gradle.plugins.ear

➥ Ear.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter355

[SRC]getLibDirName()

[MSG]Violation in class org.gradle.plugins.ear.Ear. getLibDirName() can probably be rewritten as libDirName

UnnecessarySubstring366

[SRC]module = new DefaultEarWebModule(details.path, details.p..dexOf('.')))

[MSG]Violation in class org.gradle.plugins.ear.Ear. The String.substring(int, int) method can be replaced with the subscript operator

UnnecessaryGetter3128

[SRC]return ConfigureUtil.configure(configureClosure, getLib())

[MSG]Violation in class org.gradle.plugins.ear.Ear. getLib() can probably be rewritten as lib

➥ EarPluginConvention.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration365

[SRC]def EarPluginConvention(FileResolver fileResolver) {

[MSG]Violation in class org.gradle.plugins.ear.EarPluginConvention. The def keyword is unneeded on constructors

Package: src.org.gradle.plugins.ear.descriptor.internal

➥ DefaultDeploymentDescriptor.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter3189

[SRC]if (file.getParentFile() != null) {

[MSG]Violation in class org.gradle.plugins.ear.descriptor.internal.DefaultDeploymentDescriptor. getParentFile() can probably be rewritten as parentFile

UnnecessaryGetter3190

[SRC]file.getParentFile().mkdirs()

[MSG]Violation in class org.gradle.plugins.ear.descriptor.internal.DefaultDeploymentDescriptor. getParentFile() can probably be rewritten as parentFile

➥ DefaultEarWebModule.groovy

Rule NamePriorityLine #Source Line / Message
UnusedObject239

[SRC]new Node(web, nodeNameFor("web-uri", name), path)

[MSG]The instantiated object is not used

UnusedObject240

[SRC]new Node(web, nodeNameFor("context-root", name), contextRoot)

[MSG]The instantiated object is not used

Package: src.org.gradle.plugins.ide.eclipse

➥ EclipseWtpPlugin.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter344

[SRC]EclipsePlugin delegatePlugin = project.getPlugins().appl..ugin.class);

[MSG]Violation in class org.gradle.plugins.ide.eclipse.EclipseWtpPlugin. getPlugins() can probably be rewritten as plugins

UnnecessaryDotClass344

[SRC]EclipsePlugin delegatePlugin = project.getPlugins().appl..ugin.class);

[MSG]EclipsePlugin.class can be rewritten as EclipsePlugin

UnnecessaryGetter350

[SRC]delegatePlugin.getLifecycleTask().dependsOn(getLifecycleTask())

[MSG]Violation in class org.gradle.plugins.ide.eclipse.EclipseWtpPlugin. getLifecycleTask() can probably be rewritten as lifecycleTask

UnnecessaryGetter350

[SRC]delegatePlugin.getLifecycleTask().dependsOn(getLifecycleTask())

[MSG]Violation in class org.gradle.plugins.ide.eclipse.EclipseWtpPlugin. getLifecycleTask() can probably be rewritten as lifecycleTask

UnnecessaryGetter351

[SRC]delegatePlugin.getCleanTask().dependsOn(getCleanTask())

[MSG]Violation in class org.gradle.plugins.ide.eclipse.EclipseWtpPlugin. getCleanTask() can probably be rewritten as cleanTask

UnnecessaryGetter351

[SRC]delegatePlugin.getCleanTask().dependsOn(getCleanTask())

[MSG]Violation in class org.gradle.plugins.ide.eclipse.EclipseWtpPlugin. getCleanTask() can probably be rewritten as cleanTask

UnnecessaryDotClass396

[SRC]if (WarPlugin.class.isAssignableFrom(type)) {

[MSG]WarPlugin.class can be rewritten as WarPlugin

UnnecessaryDotClass3102

[SRC]} else if (EarPlugin.class.isAssignableFrom(type)) {

[MSG]EarPlugin.class can be rewritten as EarPlugin

➥ GenerateEclipseJdt.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter337

[SRC]jdt = services.get(Instantiator).newInstance(EclipseJdt,..nsformer()))

[MSG]Violation in class org.gradle.plugins.ide.eclipse.GenerateEclipseJdt. getTransformer() can probably be rewritten as transformer

UnnecessaryGetter341

[SRC]return new Jdt(getTransformer())

[MSG]Violation in class org.gradle.plugins.ide.eclipse.GenerateEclipseJdt. getTransformer() can probably be rewritten as transformer

UnnecessaryGetter345

[SRC]def jdtModel = getJdt()

[MSG]Violation in class org.gradle.plugins.ide.eclipse.GenerateEclipseJdt. getJdt() can probably be rewritten as jdt

Package: src.org.gradle.plugins.ide.eclipse.model

➥ AbstractClasspathEntry.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter361

[SRC]def allAttributes = attributes.findAll { it.value } + [k.. path: path]

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry. getKind() can probably be rewritten as kind

➥ AccessRule.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration325

[SRC]def AccessRule(kind, pattern) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.AccessRule. The def keyword is unneeded on constructors

➥ BuildCommand.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration325

[SRC]def BuildCommand(String name, Map arguments = [:]) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.BuildCommand. The def keyword is unneeded on constructors

➥ EclipseWtpComponent.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter3144

[SRC]getLibConfigurations()

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.EclipseWtpComponent. getLibConfigurations() can probably be rewritten as libConfigurations

➥ EclipseWtpFacet.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter3115

[SRC]xmlFacet.configure(getFacets())

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.EclipseWtpFacet. getFacets() can probably be rewritten as facets

➥ Facet.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration330

[SRC]def Facet() {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Facet. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration334

[SRC]def Facet(Node node) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Facet. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration338

[SRC]def Facet(String name, String version) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Facet. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration342

[SRC]def Facet(FacetType type, String name, String version) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Facet. The def keyword is unneeded on constructors

➥ Link.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration329

[SRC]def Link(String name, String type, String location, Stri..cationUri) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Link. The def keyword is unneeded on constructors

➥ Output.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration327

[SRC]def Output(Node node) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Output. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration331

[SRC]def Output(String path) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Output. The def keyword is unneeded on constructors

UnnecessaryGetter341

[SRC]node.appendNode('classpathentry', [kind: getKind(), path: path])

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Output. getKind() can probably be rewritten as kind

➥ Project.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration359

[SRC]def Project(XmlTransformer xmlTransformer) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Project. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration376

[SRC]private def readReferencedProjects() {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Project. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration382

[SRC]private def readNatures() {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Project. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration386

[SRC]private def readBuildCommands() {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Project. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration396

[SRC]private def readLinkedResources() {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Project. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3132

[SRC]private def addReferencedProjectsToXml() {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Project. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3139

[SRC]private def addNaturesToXml() {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Project. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3146

[SRC]private def addBuildSpecToXml() {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Project. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3160

[SRC]private def addLinkedResourcesToXml() {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.Project. The def keyword is unneeded when a method is marked private

➥ WbDependentModule.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration328

[SRC]def WbDependentModule(node) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.WbDependentModule. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration332

[SRC]def WbDependentModule(String deployPath, String handle) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.WbDependentModule. The def keyword is unneeded on constructors

➥ WbProperty.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration326

[SRC]def WbProperty(node) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.WbProperty. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration330

[SRC]def WbProperty(String name, String value) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.WbProperty. The def keyword is unneeded on constructors

➥ WbResource.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration328

[SRC]def WbResource(node) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.WbResource. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration332

[SRC]def WbResource(String deployPath, String sourcePath) {

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.WbResource. The def keyword is unneeded on constructors

Package: src.org.gradle.plugins.ide.eclipse.model.internal

➥ FileReferenceFactory.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessarySubstring349

[SRC]path = entry.key + filePath.substring(len)

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory. The String.substring(int) method can be replaced with the subscript operator

UnnecessarySubstring391

[SRC]def file = new File(entry.value, path.substring(prefix.length()))

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory. The String.substring(int) method can be replaced with the subscript operator

UnnecessaryGetter3130

[SRC]", jarUrl='" + getJarURL() + '\'' +

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory$FileReferenceImpl. getJarURL() can probably be rewritten as jarURL

➥ WtpComponentFactory.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryCollectCall3100

[SRC]dependencies.collect { it.resolve() }.flatten() as LinkedHashSet

[MSG]Violation in class org.gradle.plugins.ide.eclipse.model.internal.WtpComponentFactory. The call to collect could probably be rewritten as a spread expression: dependencies*.resolve()

Package: src.org.gradle.plugins.ide.idea

➥ GenerateIdeaModule.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter343

[SRC]getModule().mergeXmlModule(xmlModule)

[MSG]Violation in class org.gradle.plugins.ide.idea.GenerateIdeaModule. getModule() can probably be rewritten as module

➥ GenerateIdeaProject.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter337

[SRC]getIdeaProject().mergeXmlProject(xmlModule)

[MSG]Violation in class org.gradle.plugins.ide.idea.GenerateIdeaProject. getIdeaProject() can probably be rewritten as ideaProject

➥ GenerateIdeaWorkspace.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter337

[SRC]getWorkspace().mergeXmlWorkspace(xmlWorkspace)

[MSG]Violation in class org.gradle.plugins.ide.idea.GenerateIdeaWorkspace. getWorkspace() can probably be rewritten as workspace

Package: src.org.gradle.plugins.ide.idea.model

➥ IdeaModel.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter360

[SRC]ConfigureUtil.configure(closure, getModule())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModel. getModule() can probably be rewritten as module

UnnecessaryGetter371

[SRC]ConfigureUtil.configure(closure, getProject())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModel. getProject() can probably be rewritten as project

UnnecessaryGetter382

[SRC]ConfigureUtil.configure(closure, getWorkspace())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModel. getWorkspace() can probably be rewritten as workspace

➥ IdeaModule.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter3277

[SRC]ConfigureUtil.configure(closure, getIml())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getIml() can probably be rewritten as iml

UnnecessaryGetter3288

[SRC]new File((File) iml.getGenerateTo(), getName() + ".iml")

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getGenerateTo() can probably be rewritten as generateTo

UnnecessaryGetter3288

[SRC]new File((File) iml.getGenerateTo(), getName() + ".iml")

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getName() can probably be rewritten as name

UnnecessaryGetter3302

[SRC]return new IdeaDependenciesProvider().provide(this, getPathFactory())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getPathFactory() can probably be rewritten as pathFactory

UnnecessaryGetter3330

[SRC]def path = { getPathFactory().path(it) }

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getPathFactory() can probably be rewritten as pathFactory

UnnecessaryGetter3331

[SRC]def contentRoot = path(getContentRoot())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getContentRoot() can probably be rewritten as contentRoot

UnnecessaryGetter3332

[SRC]Set sourceFolders = getSourceDirs().findAll { it.exists(..{ path(it) }

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getSourceDirs() can probably be rewritten as sourceDirs

UnnecessaryGetter3333

[SRC]Set testSourceFolders = getTestSourceDirs().findAll { it..{ path(it) }

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getTestSourceDirs() can probably be rewritten as testSourceDirs

UnnecessaryGetter3334

[SRC]Set excludeFolders = getExcludeDirs().collect { path(it) }

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getExcludeDirs() can probably be rewritten as excludeDirs

UnnecessaryGetter3335

[SRC]def outputDir = getOutputDir() ? path(getOutputDir()) : null

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getOutputDir() can probably be rewritten as outputDir

UnnecessaryGetter3335

[SRC]def outputDir = getOutputDir() ? path(getOutputDir()) : null

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getOutputDir() can probably be rewritten as outputDir

UnnecessaryGetter3336

[SRC]def testOutputDir = getTestOutputDir() ? path(getTestOut..ir()) : null

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getTestOutputDir() can probably be rewritten as testOutputDir

UnnecessaryGetter3336

[SRC]def testOutputDir = getTestOutputDir() ? path(getTestOut..ir()) : null

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getTestOutputDir() can probably be rewritten as testOutputDir

UnnecessaryGetter3340

[SRC]getInheritOutputDirs(), outputDir, testOutputDir, depend..etJdkName())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getInheritOutputDirs() can probably be rewritten as inheritOutputDirs

UnnecessaryGetter3340

[SRC]getInheritOutputDirs(), outputDir, testOutputDir, depend..etJdkName())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaModule. getJdkName() can probably be rewritten as jdkName

➥ IdeaProject.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter3136

[SRC]getOutputFile().name.replaceFirst(/\.ipr$/, '')

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaProject. getOutputFile() can probably be rewritten as outputFile

UnnecessaryGetter3146

[SRC]ConfigureUtil.configure(closure, getIpr())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaProject. getIpr() can probably be rewritten as ipr

UnnecessaryGetter3162

[SRC]def modulePaths = getModules().collect {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaProject. getModules() can probably be rewritten as modules

UnnecessaryGetter3163

[SRC]getPathFactory().relativePath('PROJECT_DIR', it.outputFile)

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaProject. getPathFactory() can probably be rewritten as pathFactory

UnnecessaryGetter3165

[SRC]xmlProject.configure(modulePaths, getJdkName(), getLangu..Wildcards())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaProject. getJdkName() can probably be rewritten as jdkName

UnnecessaryGetter3165

[SRC]xmlProject.configure(modulePaths, getJdkName(), getLangu..Wildcards())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaProject. getLanguageLevel() can probably be rewritten as languageLevel

UnnecessaryGetter3165

[SRC]xmlProject.configure(modulePaths, getJdkName(), getLangu..Wildcards())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaProject. getWildcards() can probably be rewritten as wildcards

➥ IdeaWorkspace.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter348

[SRC]ConfigureUtil.configure(closure, getIws())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.IdeaWorkspace. getIws() can probably be rewritten as iws

➥ JarDirectory.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration334

[SRC]def JarDirectory(path, recursive) {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.JarDirectory. The def keyword is unneeded on constructors

➥ Jdk.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration330

[SRC]def Jdk(String jdkName, IdeaLanguageLevel ideaLanguageLevel) {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.Jdk. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration346

[SRC]def Jdk(assertKeyword, jdk15, languageLevel, projectJdkName) {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.Jdk. The def keyword is unneeded on constructors

➥ Module.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration3155

[SRC]protected def configure(Path contentPath, Set sourceFold..ludeFolders,

[MSG]Violation in class org.gradle.plugins.ide.idea.model.Module. The def keyword is unneeded when a method is marked protected

➥ ModuleDependency.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration336

[SRC]def ModuleDependency(name, scope) {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.ModuleDependency. The def keyword is unneeded on constructors

UnnecessaryGetter343

[SRC]parentNode.appendNode('orderEntry', [type: 'module', 'mo..dExported())

[MSG]Violation in class org.gradle.plugins.ide.idea.model.ModuleDependency. getAttributeMapForScopeAndExported() can probably be rewritten as attributeMapForScopeAndExported

UnnecessaryElseStatement368

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

UnnecessaryGetter377

[SRC]result = 31 * result + getScopeHash();

[MSG]Violation in class org.gradle.plugins.ide.idea.model.ModuleDependency. getScopeHash() can probably be rewritten as scopeHash

➥ ModuleLibrary.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration351

[SRC]def ModuleLibrary(Collection<Path> classes, Collection<P..ing scope) {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.ModuleLibrary. The def keyword is unneeded on constructors

UnnecessaryGetter361

[SRC]Node libraryNode = parentNode.appendNode('orderEntry', [..e('library')

[MSG]Violation in class org.gradle.plugins.ide.idea.model.ModuleLibrary. getAttributeMapForScopeAndExported() can probably be rewritten as attributeMapForScopeAndExported

UnnecessaryElseStatement3104

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

UnnecessaryGetter3117

[SRC]result = 31 * result + getScopeHash()

[MSG]Violation in class org.gradle.plugins.ide.idea.model.ModuleLibrary. getScopeHash() can probably be rewritten as scopeHash

➥ PathFactory.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessarySubstring384

[SRC]expandedUrl = toUrl('file', new File(expandedUrl.substri..nonicalFile)

[MSG]Violation in class org.gradle.plugins.ide.idea.model.PathFactory. The String.substring(int) method can be replaced with the subscript operator

UnnecessarySubstring386

[SRC]def parts = expandedUrl.substring(6).split('!')

[MSG]Violation in class org.gradle.plugins.ide.idea.model.PathFactory. The String.substring(int) method can be replaced with the subscript operator

UnnecessaryDefInMethodDeclaration394

[SRC]private def toUrl(String scheme, File file) {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.PathFactory. The def keyword is unneeded when a method is marked private

UnnecessaryElseStatement3106

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

➥ Project.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration344

[SRC]def Project(XmlTransformer xmlTransformer, pathFactory) {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.Project. The def keyword is unneeded on constructors

UnnecessaryDefInMethodDeclaration396

[SRC]private def findProjectRootManager() {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.Project. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3100

[SRC]private def findWildcardResourcePatterns() {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.Project. The def keyword is unneeded when a method is marked private

UnnecessaryDefInMethodDeclaration3104

[SRC]private def findModules() {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.Project. The def keyword is unneeded when a method is marked private

➥ SingleEntryModuleLibrary.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryElseStatement363

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

UnnecessaryElseStatement374

[SRC]} else {

[MSG]When an if statement block ends with a return statement the else is unnecessary

➥ Workspace.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInMethodDeclaration328

[SRC]def Workspace(XmlTransformer withXmlActions) {

[MSG]Violation in class org.gradle.plugins.ide.idea.model.Workspace. The def keyword is unneeded on constructors

Package: src.org.gradle.plugins.ide.internal

➥ IdeDependenciesExtractor.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryPackageReference3118

[SRC]def filter = { it instanceof SelfResolvingDependency && ..Dependency)}

[MSG]The org.gradle.api.artifacts.ProjectDependency class was explicitly imported, so specifying the package name is not necessary

UnnecessaryCollectCall3122

[SRC]def files = deps.collect { it.resolve() }.flatten()

[MSG]Violation in class org.gradle.plugins.ide.internal.IdeDependenciesExtractor. The call to collect could probably be rewritten as a spread expression: deps*.resolve()

UnnecessaryCollectCall3127

[SRC]def files = deps.collect { it.resolve() }.flatten()

[MSG]Violation in class org.gradle.plugins.ide.internal.IdeDependenciesExtractor. The call to collect could probably be rewritten as a spread expression: deps*.resolve()

➥ IdePlugin.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter265

[SRC]protected void onApply(Project target) {

[MSG]Violation in class IdePlugin. Method parameter [target] is never referenced in the method onApply of class org.gradle.plugins.ide.internal.IdePlugin

UnnecessaryGetter332

[SRC]String lifecyleTaskName = getLifecycleTaskName();

[MSG]Violation in class org.gradle.plugins.ide.internal.IdePlugin. getLifecycleTaskName() can probably be rewritten as lifecycleTaskName

UnnecessaryGetter349

[SRC]return project.getTasks().getByName(cleanName(worker.getName()));

[MSG]Violation in class org.gradle.plugins.ide.internal.IdePlugin. getTasks() can probably be rewritten as tasks

UnnecessaryGetter349

[SRC]return project.getTasks().getByName(cleanName(worker.getName()));

[MSG]Violation in class org.gradle.plugins.ide.internal.IdePlugin. getName() can probably be rewritten as name

UnnecessaryGetter358

[SRC]Delete cleanWorker = project.getTasks().add(cleanName(wo..elete.class)

[MSG]Violation in class org.gradle.plugins.ide.internal.IdePlugin. getTasks() can probably be rewritten as tasks

UnnecessaryGetter358

[SRC]Delete cleanWorker = project.getTasks().add(cleanName(wo..elete.class)

[MSG]Violation in class org.gradle.plugins.ide.internal.IdePlugin. getName() can probably be rewritten as name

UnnecessaryDotClass358

[SRC]Delete cleanWorker = project.getTasks().add(cleanName(wo..elete.class)

[MSG]Delete.class can be rewritten as Delete

UnnecessaryGetter359

[SRC]cleanWorker.delete(worker.getOutputs().getFiles())

[MSG]Violation in class org.gradle.plugins.ide.internal.IdePlugin. getFiles() can probably be rewritten as files

UnnecessaryGetter359

[SRC]cleanWorker.delete(worker.getOutputs().getFiles())

[MSG]Violation in class org.gradle.plugins.ide.internal.IdePlugin. getOutputs() can probably be rewritten as outputs

Package: src.org.gradle.plugins.ide.internal.configurer

➥ DeduplicationTarget.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInFieldDeclaration326

[SRC]def String moduleName

[MSG]Violation in class org.gradle.plugins.ide.internal.configurer.DeduplicationTarget. The def keyword is unneeded when a field type is specified

UnnecessaryDefInFieldDeclaration327

[SRC]def Project project

[MSG]Violation in class org.gradle.plugins.ide.internal.configurer.DeduplicationTarget. The def keyword is unneeded when a field type is specified

UnnecessaryDefInFieldDeclaration328

[SRC]def Closure updateModuleName

[MSG]Violation in class org.gradle.plugins.ide.internal.configurer.DeduplicationTarget. The def keyword is unneeded when a field type is specified

Package: src.org.gradle.plugins.ide.internal.generator

➥ AbstractPersistableConfigurationObject.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter338

[SRC]String defaultResourceName = getDefaultResourceName();

[MSG]Violation in class org.gradle.plugins.ide.internal.generator.AbstractPersistableConfigurationObject. getDefaultResourceName() can probably be rewritten as defaultResourceName

UnnecessaryGetter341

[SRC]throw new IllegalStateException(String.format("Failed to..getName()));

[MSG]Violation in class org.gradle.plugins.ide.internal.generator.AbstractPersistableConfigurationObject. getName() can probably be rewritten as name

➥ XmlPersistableConfigurationObject.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter251

[SRC]protected void load(Node xml) {

[MSG]Violation in class XmlPersistableConfigurationObject. Method parameter [xml] is never referenced in the method load of class org.gradle.plugins.ide.internal.generator.XmlPersistableConfigurationObject

UnusedMethodParameter258

[SRC]protected void store(Node xml) {

[MSG]Violation in class XmlPersistableConfigurationObject. Method parameter [xml] is never referenced in the method store of class org.gradle.plugins.ide.internal.generator.XmlPersistableConfigurationObject

Package: src.org.gradle.plugins.signing

➥ Sign.groovy

Rule NamePriorityLine #Source Line / Message
UnusedMethodParameter2138

[SRC]void signatureType(SignatureType type) {

[MSG]Violation in class Sign. Method parameter [type] is never referenced in the method signatureType of class org.gradle.plugins.signing.Sign

UnnecessaryGetter365

[SRC]isRequired() || getSignatory() != null

[MSG]Violation in class org.gradle.plugins.signing.Sign. getSignatory() can probably be rewritten as signatory

UnnecessaryGetter369

[SRC]inputs.property("signatory") { getSignatory()?.keyId?.asHex }

[MSG]Violation in class org.gradle.plugins.signing.Sign. getSignatory() can probably be rewritten as signatory

UnnecessaryGetter371

[SRC]inputs.files { getSignatures()*.toSign }

[MSG]Violation in class org.gradle.plugins.signing.Sign. getSignatures() can probably be rewritten as signatures

UnnecessaryGetter372

[SRC]outputs.files { getSignatures()*.toSign }

[MSG]Violation in class org.gradle.plugins.signing.Sign. getSignatures() can probably be rewritten as signatures

UnnecessaryGetter3161

[SRC]if (getSignatory() == null) {

[MSG]Violation in class org.gradle.plugins.signing.Sign. getSignatory() can probably be rewritten as signatory

UnnecessaryGetter3162

[SRC]throw new InvalidUserDataException("Cannot perform signi.. signatory")

[MSG]Violation in class org.gradle.plugins.signing.Sign. getPath() can probably be rewritten as path

UnnecessaryGetter3165

[SRC]getSignatures()*.generate()

[MSG]Violation in class org.gradle.plugins.signing.Sign. getSignatures() can probably be rewritten as signatures

UnnecessaryGetter3182

[SRC]def signatureSet = getSignatures()

[MSG]Violation in class org.gradle.plugins.signing.Sign. getSignatures() can probably be rewritten as signatures

UnnecessaryGetter3196

[SRC]new SimpleFileCollection(*getSignatures()*.toSign.findAl.. != null }))

[MSG]Violation in class org.gradle.plugins.signing.Sign. getSignatures() can probably be rewritten as signatures

UnnecessaryGetter3203

[SRC]new SimpleFileCollection(*getSignatures()*.file.findAll(.. != null }))

[MSG]Violation in class org.gradle.plugins.signing.Sign. getSignatures() can probably be rewritten as signatures

➥ SignOperation.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter361

[SRC]getDisplayName()

[MSG]Violation in class org.gradle.plugins.signing.SignOperation. getDisplayName() can probably be rewritten as displayName

➥ Signature.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter3176

[SRC]name == null ? (toSignArtifact?.name ?: getFile()?.name) : name

[MSG]Violation in class org.gradle.plugins.signing.Signature. getFile() can probably be rewritten as file

UnnecessaryGetter3187

[SRC]extension == null ? getSignatureType()?.extension : extension

[MSG]Violation in class org.gradle.plugins.signing.Signature. getSignatureType() can probably be rewritten as signatureType

UnnecessaryGetter3200

[SRC]def toSign = getToSign()

[MSG]Violation in class org.gradle.plugins.signing.Signature. getToSign() can probably be rewritten as toSign

UnnecessaryGetter3201

[SRC]def signatureType = getSignatureType()

[MSG]Violation in class org.gradle.plugins.signing.Signature. getSignatureType() can probably be rewritten as signatureType

UnnecessaryGetter3234

[SRC]def file = getFile()

[MSG]Violation in class org.gradle.plugins.signing.Signature. getFile() can probably be rewritten as file

UnnecessaryGetter3260

[SRC]def toSign = getToSign()

[MSG]Violation in class org.gradle.plugins.signing.Signature. getToSign() can probably be rewritten as toSign

UnnecessaryGetter3261

[SRC]def signatureType = getSignatureType()

[MSG]Violation in class org.gradle.plugins.signing.Signature. getSignatureType() can probably be rewritten as signatureType

UnnecessaryGetter3279

[SRC]signatureSpec.getSignatory()

[MSG]Violation in class org.gradle.plugins.signing.Signature. getSignatory() can probably be rewritten as signatory

UnnecessaryGetter3288

[SRC]signatureSpec.getSignatureType()

[MSG]Violation in class org.gradle.plugins.signing.Signature. getSignatureType() can probably be rewritten as signatureType

UnnecessaryGetter3300

[SRC]def toSign = getToSign()

[MSG]Violation in class org.gradle.plugins.signing.Signature. getToSign() can probably be rewritten as toSign

UnnecessaryGetter3309

[SRC]def signatory = getSignatory()

[MSG]Violation in class org.gradle.plugins.signing.Signature. getSignatory() can probably be rewritten as signatory

UnnecessaryGetter3318

[SRC]def signatureType = getSignatureType()

[MSG]Violation in class org.gradle.plugins.signing.Signature. getSignatureType() can probably be rewritten as signatureType

➥ SigningExtension.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter3118

[SRC]this.configuration = getDefaultConfiguration()

[MSG]Violation in class org.gradle.plugins.signing.SigningExtension. getDefaultConfiguration() can probably be rewritten as defaultConfiguration

UnnecessaryGetter3198

[SRC]spec.conventionMapping.map('signatory') { getSignatory() }

[MSG]Violation in class org.gradle.plugins.signing.SigningExtension. getSignatory() can probably be rewritten as signatory

UnnecessaryGetter3199

[SRC]spec.conventionMapping.map('signatureType') { getSignatureType() }

[MSG]Violation in class org.gradle.plugins.signing.SigningExtension. getSignatureType() can probably be rewritten as signatureType

UnnecessaryGetter3222

[SRC]addSignaturesToConfiguration(signTask, getConfiguration())

[MSG]Violation in class org.gradle.plugins.signing.SigningExtension. getConfiguration() can probably be rewritten as configuration

UnnecessaryGetter3243

[SRC]this.addSignaturesToConfiguration(signTask, getConfiguration())

[MSG]Violation in class org.gradle.plugins.signing.SigningExtension. getConfiguration() can probably be rewritten as configuration

Package: src.org.gradle.plugins.signing.signatory.pgp

➥ PgpKeyId.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessarySubstring363

[SRC]normalised = keyIdUpped.substring(2)

[MSG]Violation in class org.gradle.plugins.signing.signatory.pgp.PgpKeyId. The String.substring(int) method can be replaced with the subscript operator

Package: src.org.gradle.plugins.signing.type

➥ AbstractSignatureType.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryGetter337

[SRC]new File(toSign.path + ".${getExtension()}")

[MSG]Violation in class org.gradle.plugins.signing.type.AbstractSignatureType. getExtension() can probably be rewritten as extension

UnnecessaryGetter344

[SRC]getExtension()

[MSG]Violation in class org.gradle.plugins.signing.type.AbstractSignatureType. getExtension() can probably be rewritten as extension

UnnecessaryGetter346

[SRC]name[++dotIndex..-1] + ".${getExtension()}"

[MSG]Violation in class org.gradle.plugins.signing.type.AbstractSignatureType. getExtension() can probably be rewritten as extension

Package: src.org.gradle.profile

➥ HTMLProfileReport.groovy

Rule NamePriorityLine #Source Line / Message
StaticSimpleDateFormatField225

[SRC]private static final SimpleDateFormat DATE_FORMAT = new .. HH:mm:ss");

[MSG]Violation in class org.gradle.profile.HTMLProfileReport. SimpleDateFormat instances are not thread safe. Wrap the SimpleDateFormat field DATE_FORMAT in a ThreadLocal or make it an instance field

Package: src.org.gradle.util

➥ ReflectionUtil.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDotClass349

[SRC]return Boolean.class;

[MSG]Boolean.class can be rewritten as Boolean

UnnecessaryDotClass351

[SRC]return Long.class;

[MSG]Long.class can be rewritten as Long

UnnecessaryDotClass353

[SRC]return Integer.class;

[MSG]Integer.class can be rewritten as Integer

UnnecessaryDotClass355

[SRC]return Short.class;

[MSG]Short.class can be rewritten as Short

UnnecessaryDotClass357

[SRC]return Byte.class;

[MSG]Byte.class can be rewritten as Byte

UnnecessaryDotClass359

[SRC]return Float.class;

[MSG]Float.class can be rewritten as Float

UnnecessaryDotClass361

[SRC]return Double.class;

[MSG]Double.class can be rewritten as Double

➥ Requires.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDotClass327

[SRC]@ExtensionAnnotation(TestPreconditionExtension.class)

[MSG]TestPreconditionExtension.class can be rewritten as TestPreconditionExtension

➥ TestDirHelper.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryDefInFieldDeclaration319

[SRC]def TestFile baseDir

[MSG]Violation in class org.gradle.util.TestDirHelper. The def keyword is unneeded when a field type is specified

UnnecessaryDefInMethodDeclaration321

[SRC]def TestDirHelper(TestFile baseDir) {

[MSG]Violation in class org.gradle.util.TestDirHelper. The def keyword is unneeded on constructors

➥ TestFileHelper.groovy

Rule NamePriorityLine #Source Line / Message
AssignmentInConditional240

[SRC]while (entry = zipStr.getNextEntry()) {

[MSG]Assignment used as conditional value, which always results in true. Use the == operator instead

MisorderedStaticImports322

[SRC]import static org.hamcrest.Matchers.equalTo

[MSG]Static imports should appear before normal imports

MisorderedStaticImports323

[SRC]import static org.junit.Assert.assertThat

[MSG]Static imports should appear before normal imports

MisorderedStaticImports324

[SRC]import static org.junit.Assert.assertTrue

[MSG]Static imports should appear before normal imports

UnnecessaryGetter340

[SRC]while (entry = zipStr.getNextEntry()) {

[MSG]Violation in class org.gradle.util.TestFileHelper. getNextEntry() can probably be rewritten as nextEntry

UnnecessarySubstring3110

[SRC]return perms.substring(1, 10)

[MSG]Violation in class org.gradle.util.TestFileHelper. The String.substring(int, int) method can be replaced with the subscript operator

➥ TestPreconditionExtension.groovy

Rule NamePriorityLine #Source Line / Message
UnnecessaryParenthesesForMethodCallWithClosure325

[SRC]spec.skipped = annotation.value().any() { !it.fulfilled }

[MSG]Violation in class org.gradle.util.TestPreconditionExtension. Parentheses in the 'any' method call are unnecessary and can be removed.

UnnecessaryParenthesesForMethodCallWithClosure330

[SRC]feature.skipped = annotation.value().any() { !it.fulfilled }

[MSG]Violation in class org.gradle.util.TestPreconditionExtension. Parentheses in the 'any' method call are unnecessary and can be removed.

Rule Descriptions

#Rule NameDescription
1AddEmptyStringFinds empty string literals which are being added. This is an inefficient way to convert any type to a String.
2AssertWithinFinallyBlockChecks for assert statements within a finally block. An assert can throw an exception, hiding the original exception, if there is one.
3AssignmentInConditionalAn assignment operator (=) was used in a conditional test. This is usually a typo, and the comparison operator (==) was intended.
4BigDecimalInstantiationChecks for calls to the BigDecimal constructors that take a double parameter, which may result in an unexpected BigDecimal value.
5BitwiseOperatorInConditionalChecks for bitwise operations in conditionals, if you need to do a bitwise operation then it is best practive to extract a temp variable.
6BooleanGetBooleanThis rule catches usages of java.lang.Boolean.getBoolean(String) which reads a boolean from the System properties. It is often mistakenly used to attempt to read user input or parse a String into a boolean. It is a poor piece of API to use; replace it with System.properties['prop'].
7BrokenNullCheckLooks for faulty checks for null that can cause a NullPointerException.
8BrokenOddnessCheckThe code uses x % 2 == 1 to check to see if a value is odd, but this won't work for negative numbers (e.g., (-5) % 2 == -1). If this code is intending to check for oddness, consider using x & 1 == 1, or x % 2 != 0.
9BusyWaitBusy waiting (forcing a Thread.sleep() while waiting on a condition) should be avoided. Prefer using the gate and barrier objects in the java.util.concurrent package.
10ChainedTestA test method that invokes another test method is a chained test; the methods are dependent on one another. Tests should be isolated, and not be dependent on one another.
11ClassForNameUsing Class.forName(...) is a common way to add dynamic behavior to a system. However, using this method can cause resource leaks because the classes can be pinned in memory for long periods of time.
12ComparisonOfTwoConstantsChecks for expressions where a comparison operator or equals() or compareTo() is used to compare two constants to each other or two literals that contain only constant values., e.g.: 23 == 67, Boolean.FALSE != false, 0.17 <= 0.99, "abc" > "ddd", [a:1] <=> [a:2], [1,2].equals([3,4]) or [a:false, b:true].compareTo(['a':34.5, b:Boolean.TRUE].
13ComparisonWithSelfChecks for expressions where a comparison operator or equals() or compareTo() is used to compare a variable to itself, e.g.: x == x, x != x, x <=> x, x < x, x =>= x, x.equals(x) or x.compareTo(x), where x is a variable.
14ConsecutiveLiteralAppendsViolations occur when method calls to append(Object) are chained together with literals as parameters. The chained calls can be joined into one invocation.
15ConsecutiveStringConcatenationCatches concatenation of two string literals on the same line. These can safely by joined.
16ConstantAssertExpressionChecks for assert statements where the assert boolean condition expression is a constant or literal value.
17ConstantIfExpressionChecks for if statements with a constant value for the if expression, such as true, false, null, or a literal constant value.
18ConstantTernaryExpressionChecks for ternary expressions with a constant value for the boolean expression, such as true, false, null, or a literal constant value.
19CoupledTestCaseThis rule finds test cases that are coupled to other test cases, either by invoking static methods on another test case or by creating instances of another test case. If you require shared logic in test cases then extract that logic to a new class where it can properly be reused.
20CyclomaticComplexityChecks the cyclomatic complexity for methods/classes.A method (or "closure field") with a cyclomatic complexity value greater than the maxMethodComplexity property (20) causes a violation. Likewise, a class that has an (average method) cyclomatic complexityvalue greater than the maxClassAverageMethodComplexity property (20) causes a violation.
21DeadCodeDead code appears after a return statement or an exception is thrown. If code appears after one of these statements then it will never be executed and can be safely deleted.
22DoubleCheckedLockingThis rule detects double checked locking, where a 'lock hint' is tested for null before initializing an object within a synchronized block. Double checked locking does not guarantee correctness and is an anti-pattern.
23DoubleNegativeThere is no point in using a double negative, it is always positive. For instance !!x can always be simplified to x. And !(!x) can as well.
24DuplicateCaseStatementCheck for duplicate case statements in a switch block, such as two equal integers or strings.
25DuplicateImportDuplicate import statements are unnecessary.
26DuplicateMapKeyA map literal is created with duplicated key. The map entry will be overwritten.
27DuplicateSetValueA Set literal is created with duplicate constant value. A set cannot contain two elements with the same value.
28EmptyCatchBlockIn most cases, exceptions should not be caught and ignored (swallowed).
29EmptyElseBlockEmpty else blocks are confusing and serve no purpose.
30EmptyFinallyBlockEmpty finally blocks are confusing and serve no purpose.
31EmptyForStatementEmpty for statements are confusing and serve no purpose.
32EmptyIfStatementEmpty if statements are confusing and serve no purpose.
33EmptyInstanceInitializerAn empty class instance initializer was found. It is safe to remove it.
34EmptyMethodA method was found without an implementation. If the method is overriding or implementing a parent method, then mark it with the @Override annotation.
35EmptyStaticInitializerAn empty static initializer was found. It is safe to remove it.
36EmptySwitchStatementEmpty switch statements are confusing and serve no purpose.
37EmptySynchronizedStatementEmpty synchronized statements are confusing and serve no purpose.
38EmptyTryBlockEmpty try blocks are confusing and serve no purpose.
39EmptyWhileStatementEmpty while statements are confusing and serve no purpose.
40EqualsAndHashCodeIf either the boolean equals(Object) or the int hashCode() methods are overridden within a class, then both must be overridden.
41EqualsOverloadedThe class has an equals method, but the parameter of the method is not of type Object. It is not overriding equals but instead overloading it.
42ExplicitGarbageCollectionCalls to System.gc(), Runtime.getRuntime().gc(), and System.runFinalization() are not advised. Code should have the same behavior whether the garbage collection is disabled using the option -Xdisableexplicitgc or not. Moreover, "modern" jvms do a very good job handling garbage collections. If memory usage issues unrelated to memory leaks develop within an application, it should be dealt with JVM options rather than within the code itself.
43ForLoopShouldBeWhileLoopA for loop without an init and update statement can be simplified to a while loop.
44HardCodedWindowsFileSeparatorThis rule finds usages of a Windows file separator within the constructor call of a File object. It is better to use the Unix file separator or use the File.separator constant.
45HardCodedWindowsRootDirectoryThis rule find cases where a File object is constructed with a windows-based path. This is not portable, and using the File.listRoots() method is a better alternative.
46ImportFromSamePackageAn import of a class that is within the same package is unnecessary.
47ImportFromSunPackagesAvoid importing anything from the 'sun.*' packages. These packages are not portable and are likely to change.
48InconsistentPropertyLockingClass contains similarly-named get and set methods where one method of the pair is marked either @WithReadLock or @WithWriteLock and the other is not locked at all.
49InconsistentPropertySynchronizationClass contains similarly-named get and set methods where the set method is synchronized and the get method is not, or the get method is synchronized and the set method is not.
50IntegerGetIntegerThis rule catches usages of java.lang.Integer.getInteger(String, ...) which reads an Integer from the System properties. It is often mistakenly used to attempt to read user input or parse a String into an Integer. It is a poor piece of API to use; replace it with System.properties['prop'].
51JUnitAssertAlwaysFailsChecks for JUnit assert() method calls with constant arguments such that the assertion always fails. This includes: assertTrue(false), assertFalse(true) and assertNull(CONSTANT).
52JUnitAssertAlwaysSucceedsChecks for JUnit assert() method calls with constant arguments such that the assertion always succeeds. This includes: assertTrue(true), assertFalse(false) and assertNull(null).
53JUnitFailWithoutMessageThis rule detects JUnit calling the fail() method without an argument. For better error reporting you should always provide a message.
54JUnitPublicNonTestMethodChecks if a JUnit test class contains public methods other than standard test methods, JUnit framework methods or methods with JUnit annotations.
55JUnitSetUpCallsSuperChecks that if the JUnit setUp() method is defined, that it includes a call to super.setUp().
56JUnitTearDownCallsSuperChecks that if the JUnit tearDown() method is defined, that it includes a call to super.tearDown().
57JUnitTestMethodWithoutAssertThis rule searches for test methods that do not contain assert statements. Either the test method is missing assert statements, which is an error, or the test method contains custom assert statements that do not follow a proper assert naming convention. Test methods are defined as public void methods that begin with the work test or have a @Test annotation. By default this rule applies to the default test class names, but this can be changed using the rule's applyToClassNames property.
58JUnitUnnecessarySetUpChecks for JUnit setUp() methods that contain only a call to super.setUp().
59JUnitUnnecessaryTearDownChecks for JUnit tearDown() methods that contain only a call to super.tearDown().
60MisorderedStaticImportsStatic imports should never be declared after nonstatic imports.
61NestedSynchronizationNested synchronized statements should be avoided. Nested synchronized statements are either useless (if the lock objects are identical) or prone to deadlock.
62RandomDoubleCoercedToZeroThe Math.random() method returns a double result greater than or equal to 0.0 and less than 1.0. If you coerce this result into an Integer or int, then it is coerced to zero. Casting the result to int, or assigning it to an int field is probably a bug.
63RemoveAllOnSelfDon't use removeAll to clear a collection. If you want to remove all elements from a collection c, use c.clear, not c.removeAll(c). Calling c.removeAll(c) to clear a collection is less clear, susceptible to errors from typos, less efficient and for some collections, might throw a ConcurrentModificationException.
64ReturnFromFinallyBlockReturning from a finally block is confusing and can hide the original exception.
65SpockIgnoreRestUsedIf Spock's @IgnoreRest appears on any method, all non-annotated test methods are not executed. This behaviour is almost always unintended. It's fine to use @IgnoreRest locally during development, but when committing code, it should be removed.
66StaticCalendarFieldCalendar objects should not be used as static fields. Calendars are inherently unsafe for multihtreaded use. Sharing a single instance across thread boundaries without proper synchronization will result in erratic behavior of the application.
67StaticConnectionCreates violations when a java.sql.Connection object is used as a static field. Database connections stored in static fields will be shared between threads, which is unsafe and can lead to race conditions.
68StaticDateFormatFieldDateFormat objects should not be used as static fields. DateFormat are inherently unsafe for multithreaded use. Sharing a single instance across thread boundaries without proper synchronization will result in erratic behavior of the application.
69StaticMatcherFieldMatcher objects should not be used as static fields. Matcher instances are inherently unsafe for multithreaded use. Sharing a single instance across thread boundaries without proper synchronization will result in erratic behavior of the application.
70StaticSimpleDateFormatFieldSimpleDateFormat objects should not be used as static fields. SimpleDateFormat are inherently unsafe for multi-threaded use. Sharing a single instance across thread boundaries without proper synchronization will result in erratic behavior of the application.
71SynchronizedMethodThis rule reports uses of the synchronized keyword on methods. Synchronized methods are the same as synchronizing on 'this', which effectively make your synchronization policy public and modifiable by other objects. To avoid possibilities of deadlock, it is better to synchronize on internal objects.
72SynchronizedOnBoxedPrimitiveThe code synchronizes on a boxed primitive constant, such as an Integer. Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
73SynchronizedOnGetClassSynchronization on getClass rather than class literal. This instance method synchronizes on this.getClass(). If this class is subclassed, subclasses will synchronize on the class object for the subclass, which isn't likely what was intended.
74SynchronizedOnReentrantLockSynchronizing on a ReentrantLock field is almost never the intended usage. A ReentrantLock should be obtained using the lock() method and released in a finally block using the unlock() method.
75SynchronizedOnStringSynchronization on a String field can lead to deadlock because Strings are interned by the JVM and can be shared.
76SynchronizedOnThisThis rule reports uses of the synchronized blocks where the synchronization reference is 'this'. Doing this effectively makes your synchronization policy public and modifiable by other objects. To avoid possibilities of deadlock, it is better to synchronize on internal objects.
77SynchronizedReadObjectMethodCatches Serializable classes that define a synchronized readObject method. By definition, an object created by deserialization is only reachable by one thread, and thus there is no need for readObject() to be synchronized. If the readObject() method itself is causing the object to become visible to another thread, that is an example of very dubious coding style.
78SystemRunFinalizersOnExitMethod calls to System.runFinalizersOnExit() should not be allowed. This method is inherently non-thread-safe, may result in data corruption, deadlock, and may effect parts of the program far removed from it's call point. It is deprecated, and it's use strongly discouraged.
79ThreadGroupAvoid using ThreadGroup; although it is intended to be used in a threaded environment it contains methods that are not thread safe.
80ThreadLocalNotStaticFinalThreadLocal fields should be static and final. In the most common case a java.lang.ThreadLocal instance associates state with a thread. A non-static non-final java.lang.ThreadLocal field associates state with an instance-thread combination. This is seldom necessary and often a bug which can cause memory leaks and possibly incorrect behavior.
81ThreadYieldMethod calls to Thread.yield() should not be allowed. This method has no useful guaranteed semantics, and is often used by inexperienced programmers to mask race conditions.
82ThrowExceptionFromFinallyBlockThrowing an exception from a finally block is confusing and can hide the original exception.
83UnnecessaryBigDecimalInstantiationIt is unnecessary to instantiate BigDecimal objects. Instead just use the decimal literal or the 'G' identifier to force the type, such as 123.45 or 123.45G.
84UnnecessaryBigIntegerInstantiationIt is unnecessary to instantiate BigInteger objects. Instead just use the literal with the 'G' identifier to force the type, such as 8G or 42G.
85UnnecessaryBooleanExpressionChecks for unnecessary boolean expressions, including ANDing (&&) or ORing (||) with true, false, null, or a Map/List/String/Number literal. Also checks for negation (!) of true, false, null, or a Map/List/String/Number literal.
86UnnecessaryBooleanInstantiationUse Boolean.valueOf() for variable values or Boolean.TRUE and Boolean.FALSE for constant values instead of calling the Boolean() constructor directly or calling Boolean.valueOf(true) or Boolean.valueOf(false).
87UnnecessaryCallForLastElementThis rule checks for excessively verbose methods of accessing the last element of an array or list. For instance, it is possible to access the last element of an array by performing array[array.length - 1], in Groovy it is simpler to either call array.last() or array[-1]. The same is true for lists. This violation is triggered whenever a get, getAt, or array-style access is used with an object size check.
88UnnecessaryCallToSubstringCalling String.substring(0) always returns the original string. This code is meaningless.
89UnnecessaryCatchBlockViolations are triggered when a catch block does nothing but throw the original exception. In this scenario there is usually no need for a catch block, just let the exception be thrown from the original code. This condition frequently occurs when catching an exception for debugging purposes but then forgetting to take the catch statement out.
90UnnecessaryCollectCallSome method calls to Object.collect(Closure) can be replaced with the spread operator. For instance, list.collect { it.multiply(2) } can be replaced by list*.multiply(2).
91UnnecessaryCollectionCallUseless call to collections. This call doesn't make sense. For any collection c, calling c.containsAll(c) should always be true, and c.retainAll(c) should have no effect.
92UnnecessaryConstructorThis rule detects when a constructor is not necessary; i.e., when there's only one constructor, it's public, has an empty body, and takes no arguments.
93UnnecessaryDefInFieldDeclarationIf a field has a visibility modifier or a type declaration, then the def keyword is unneeded. For instance, 'static def constraints = {}' is redundant and can be simplified to 'static constraints = {}.
94UnnecessaryDefInMethodDeclarationIf a method has a visibility modifier or a type declaration, then the def keyword is unneeded. For instance 'def private method() {}' is redundant and can be simplified to 'private method() {}'.
95UnnecessaryDefInVariableDeclarationIf a variable has a visibility modifier or a type declaration, then the def keyword is unneeded. For instance 'def private n = 2' is redundant and can be simplified to 'private n = 2'.
96UnnecessaryDotClassTo make a reference to a class, it is unnecessary to specify the '.class' identifier. For instance String.class can be shortened to String.
97UnnecessaryDoubleInstantiationIt is unnecessary to instantiate Double objects. Instead just use the double literal or the 'D' identifier to force the type, such as 123.45d or 0.42d.
98UnnecessaryElseStatementWhen an if statement block ends with a return statement the else is unnecessary. The logic in the else branch can be run without being in a new scope.
99UnnecessaryFailIn a unit test, catching an exception and immediately calling Assert.fail() is pointless and hides the stack trace. It is better to rethrow the exception or not catch the exception at all.
100UnnecessaryFinalOnPrivateMethodA private method is marked final. Private methods cannot be overridden, so marking it final is unnecessary.
101UnnecessaryFloatInstantiationIt is unnecessary to instantiate Float objects. Instead just use the float literal with the 'F' identifier to force the type, such as 123.45F or 0.42f.
102UnnecessaryGetterChecks for explicit calls to getter/accessor methods which can, for the most part, be replaced by property access. A getter is defined as a method call that matches get[A-Z] but not getClass() or get[A-Z][A-Z] such as getURL(). Getters do not take method arguments.
103UnnecessaryGroovyImportA 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.
104UnnecessaryIfStatementChecks for if statements where the if and else blocks are merely returning true and false constants. These cases can be replaced by a simple return statement.
105UnnecessaryInstanceOfCheckThis rule finds instanceof checks that cannot possibly evaluate to true. For instance, checking that (!variable instanceof String) will never be true because the result of a not expression is always a boolean.
106UnnecessaryInstantiationToGetClassAvoid instantiating an object just to call getClass() on it; use the .class public member instead.
107UnnecessaryIntegerInstantiationIt is unnecessary to instantiate Integer objects. Instead just use the literal with the 'I' identifier to force the type, such as 8I or 42i.
108UnnecessaryLongInstantiationIt is unnecessary to instantiate Long objects. Instead just use the literal with the 'L' identifier to force the type, such as 8L or 42L.
109UnnecessaryModOneAny expression mod 1 (exp % 1) is guaranteed to always return zero. This code is probably an error, and should be either (exp & 1) or (exp % 2).
110UnnecessaryNullCheckGroovy contains the safe dereference operator, which can be used in boolean conditional statements to safely replace explicit "x == null" tests.
111UnnecessaryNullCheckBeforeInstanceOfThere is no need to check for null before an instanceof; the instanceof keyword returns false when given a null argument.
112UnnecessaryObjectReferencesViolations are triggered when an excessive set of consecutive statements all reference the same variable. This can be made more readable by using a with or identity block.
113UnnecessaryOverridingMethodThe overriding method merely calls the same method defined in a superclass
114UnnecessaryPackageReferenceChecks for explicit package reference for classes that Groovy imports by default, such as java.lang.String, java.util.Map and groovy.lang.Closure.
115UnnecessaryParenthesesForMethodCallWithClosureIf a method is called and the only parameter to that method is an inline closure then the parentheses of the method call can be omitted.
116UnnecessarySelfAssignmentMethod contains a pointless self-assignment to a variable or property.
117UnnecessaryStringInstantiationUse a String literal (e.g., "...") instead of calling the corresponding String constructor (new String("..")) directly.
118UnnecessarySubstringThis rule finds usages of String.substring(int) and String.substring(int, int) that can be replaced by use of the subscript operator. For instance, var.substring(5) can be replaced with var[5..-1].
119UnnecessaryTernaryExpressionChecks for ternary expressions where the conditional expression always evaluates to a boolean and the true and false expressions are merely returning true and false constants. Also checks for ternary expressions where both expressions are the same constant or variable.
120UnnecessaryTransientModifierThe field is marked as transient, but the class isn't Serializable, so marking it as transient has no effect.
121UnusedArrayChecks for array allocations that are not assigned or used, unless it is the last statement within a block.
122UnusedImportImports for a class that is never referenced within the source file is unnecessary.
123UnusedMethodParameterThis rule finds instances of method parameters not being used. It does not analyze private methods (that is done by the UnusedPrivateMethodParameter rule) or methods marked @Override.
124UnusedObjectChecks for object allocations that are not assigned or used, unless it is the last statement within a block
125UnusedPrivateFieldChecks for private fields that are not referenced within the same class.
126UnusedPrivateMethodChecks for private methods that are not referenced within the same class.
127UnusedPrivateMethodParameterChecks for parameters to private methods that are not referenced within the method body.
128UnusedVariableChecks for variables that are never referenced.
129UseAssertEqualsInsteadOfAssertTrueThis rule detects JUnit assertions in object equality. These assertions should be made by more specific methods, like assertEquals.
130UseAssertFalseInsteadOfNegationIn unit tests, if a condition is expected to be false then there is no sense using assertTrue with the negation operator. For instance, assertTrue(!condition) can always be simplified to assertFalse(condition)
131UseAssertNullInsteadOfAssertEqualsThis rule detects JUnit calling assertEquals where the first or second parameter is null. These assertion should be made against the assertNull method instead.
132UseAssertSameInsteadOfAssertTrueThis rule detects JUnit calling assertTrue where the first or second parameter is an Object#is() call testing for reference equality. These assertion should be made against the assertSame method instead.
133UseAssertTrueInsteadOfAssertEqualsThis rule detects JUnit calling assertEquals where the first parameter is a boolean. These assertions should be made by more specific methods, like assertTrue or assertFalse.
134UseAssertTrueInsteadOfNegationIn unit tests, if a condition is expected to be true then there is no sense using assertFalse with the negation operator. For instance, assertFalse(!condition) can always be simplified to assertTrue(condition)
135UseOfNotifyMethodThis code calls notify() rather than notifyAll(). Java monitors are often used for multiple conditions. Calling notify() only wakes up one thread, meaning that the thread woken up might not be the one waiting for the condition that the caller just satisfied.
136VolatileArrayFieldVolatile array fields are unsafe because the contents of the array are not treated as volatile. Changing the entire array reference is visible to other threads, but changing an array element is not.
137VolatileLongOrDoubleFieldLong or double fields should not be declared as volatile. Java specifies that reads and writes from such fields are atomic, but many JVM's have violated this specification. Unless you are certain of your JVM, it is better to synchronize access to such fields rather than declare them volatile. This rule flags fields marked volatile when their type is double or long or the name of their type is "Double" or "Long".
138WaitOutsideOfWhileLoopCalls to Object.wait() must be within a while loop. Consider using the Java concurrency utilities instead of wait() and notify().