CodeNarc Report

The following document contains the results of CodeNarc Report

CodeNarc Version: 0.8

Report Time: Feb 4, 2010 11:32:45 AM

Summary

Total Files Bugs Priority1 Bugs Priority2 Bugs Priority3 Bugs
99 22 0 0 24

Files

main/groovy/org/gmetrics/metric/abc/result/AggregateAbcMetricResult.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 18 import org.gmetrics.result.MetricResult

main/groovy/org/gmetrics/metricset/DefaultMetricSet.groovy

Rule Name Priority Line Source Line / Message
ImportFromSamePackage 3 19 import org.gmetrics.metricset.MetricSet

main/groovy/org/gmetrics/metricset/ListMetricSet.groovy

Rule Name Priority Line Source Line / Message
ImportFromSamePackage 3 19 import org.gmetrics.metricset.MetricSet

main/groovy/org/gmetrics/result/ClassMetricResult.groovy

Rule Name Priority Line Source Line / Message
ImportFromSamePackage 3 18 import org.gmetrics.result.MetricResult

test/groovy/org/gmetrics/analyzer/FilesystemSourceAnalyzerTest.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 18 import org.gmetrics.test.AbstractTestCase

test/groovy/org/gmetrics/metric/StubMetric.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 18 import org.gmetrics.result.ClassMetricResult

test/groovy/org/gmetrics/metric/abc/AbcTestUtil.groovy

Rule Name Priority Line Source Line / Message
UnusedImport 3 18 import org.gmetrics.metric.AbstractMetricTest

test/groovy/org/gmetrics/metric/abc/AbcVectorTest.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 18 import org.gmetrics.test.AbstractTestCase

test/groovy/org/gmetrics/metric/abc/AbstractAbcMetricTest.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 19 import org.gmetrics.result.MetricResult

test/groovy/org/gmetrics/metric/abc/result/AbcMetricResultTest.groovy

Rule Name Priority Line Source Line / Message
ImportFromSamePackage 3 19 import org.gmetrics.metric.abc.result.AbcMetricResult

test/groovy/org/gmetrics/metric/abc/result/AggregateAbcMetricResultTest.groovy

Rule Name Priority Line Source Line / Message
ImportFromSamePackage 3 20 import org.gmetrics.metric.abc.result.AggregateAbcMetricResult

test/groovy/org/gmetrics/metricset/ListMetricTest.groovy

Rule Name Priority Line Source Line / Message
ImportFromSamePackage 3 20 import org.gmetrics.metricset.ListMetricSet

test/groovy/org/gmetrics/result/AggregateNumberMetricResultTest.groovy

Rule Name Priority Line Source Line / Message
ImportFromSamePackage 3 19 import org.gmetrics.result.NumberMetricResult
ImportFromSamePackage 3 20 import org.gmetrics.result.AggregateNumberMetricResult

test/groovy/org/gmetrics/result/NumberMetricResultTest.groovy

Rule Name Priority Line Source Line / Message
ImportFromSamePackage 3 19 import org.gmetrics.result.NumberMetricResult

test/groovy/org/gmetrics/result/StubMetricResult.groovy

Rule Name Priority Line Source Line / Message
ImportFromSamePackage 3 18 import org.gmetrics.result.MetricResult

test/groovy/org/gmetrics/resultsnode/MethodResultsNodeTest.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 18 import org.gmetrics.test.AbstractTestCase
DuplicateImport 3 20 import org.gmetrics.result.NumberMetricResult

test/groovy/org/gmetrics/resultsnode/PackageResultsNodeTest.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 20 import org.gmetrics.result.NumberMetricResult

test/groovy/org/gmetrics/resultsnode/ResultsNodeTestUtil.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 18 import org.gmetrics.result.MetricResult

test/groovy/org/gmetrics/resultsnode/StubResultsNode.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 19 import org.gmetrics.result.MetricResult

test/groovy/org/gmetrics/util/WildcardPatternTest.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 18 import org.gmetrics.test.AbstractTestCase

test/groovy/org/gmetrics/util/io/ClassPathResourceTest.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 18 import org.gmetrics.test.AbstractTestCase

test/groovy/org/gmetrics/util/io/UrlResourceTest.groovy

Rule Name Priority Line Source Line / Message
DuplicateImport 3 18 import org.gmetrics.test.AbstractTestCase

Rule Description

Rule Name Description
BooleanInstantiation Use <em>Boolean.valueOf()</em> for variable values or <em>Boolean.TRUE</em> and <em>Boolean.FALSE</em> for constant values instead of calling the <em>Boolean()</em> constructor directly or calling <em>Boolean.valueOf(true)</em> or <em>Boolean.valueOf(false)</em>.
CatchError Catching <em>Error</em> is dangerous; it can catch exceptions such as <em>ThreadDeath</em> and <em>OutOfMemoryError</em>.
CatchException Catching <em>Exception</em> is often too broad or general. It should usually be restricted to framework or infrastructure code, rather than application code.
CatchNullPointerException Catching <em>NullPointerException</em> is never appropriate. It should be avoided in the first place with proper null checking, and it can mask underlying errors.
CatchRuntimeException Catching <em>RuntimeException</em> is often too broad or general. It should usually be restricted to framework or infrastructure code, rather than application code.
CatchThrowable Catching <em>Throwable</em> is dangerous; it can catch exceptions such as <em>ThreadDeath</em> and <em>OutOfMemoryError</em>.
DuplicateImport Duplicate import statements are unnecessary.
EmptyCatchBlock In most cases, exceptions should not be caught and ignored (swallowed).
EmptyElseBlock Empty <em>else</em> blocks are confusing and serve no purpose.
EmptyFinallyBlock Empty <em>finally</em> blocks are confusing and serve no purpose.
EmptyForStatement Empty <em>for</em> statements are confusing and serve no purpose.
EmptyIfStatement Empty <em>if</em> statements are confusing and serve no purpose.
EmptySwitchStatement Empty <em>switch</em> statements are confusing and serve no purpose.
EmptySynchronizedStatement Empty <em>synchronized</em> statements are confusing and serve no purpose.
EmptyTryBlock Empty <em>try</em> blocks are confusing and serve no purpose.
EmptyWhileStatement Empty <em>while</em> statements are confusing and serve no purpose.
EqualsAndHashCode If either the <em>boolean equals(Object)</em> or the <em>int hashCode()</em> methods are overridden within a class, then both must be overridden.
ImportFromSamePackage An import of a class that is within the same package is unnecessary.
ReturnFromFinallyBlock Returning from a <em>finally</em> block is confusing and can hide the original exception.
StringInstantiation Use a String literal (e.g., "...") instead of calling the corresponding String constructor (new String("..")) directly.
ThrowError Checks for throwing an instance of <em>java.lang.Error</em>.
ThrowException Checks for throwing an instance of <em>java.lang.Exception</em>.
ThrowExceptionFromFinallyBlock Throwing an exception from a <em>finally</em> block is confusing and can hide the original exception.
ThrowNullPointerException Checks for throwing an instance of <em>java.lang.NullPointerException</em>.
ThrowRuntimeException Checks for throwing an instance of <em>java.lang.RuntimeException</em>.
ThrowThrowable Checks for throwing an instance of <em>java.lang.Throwable</em>.
UnnecessaryGroovyImport A Groovy file does not need to include an import for classes from <em>java.lang</em>, <em>java.util</em>, <em>java.io</em>, <em>java.net</em>, <em>groovy.lang</em> and <em>groovy.util</em>, as well as the classes <em>java.math.BigDecimal</em> and <em>java.math.BigInteger</em>.
UnusedImport Imports for a class that is never referenced within the source file is unnecessary.