1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
<html><head><title>CodeNarc Report: Sample Project</title><style type='text/css'>body {
font-family: Arial, sans-serif;
margin: 20px 20px 20px 30px;
}
h1, h2, h3 {
font-weight: bold;
}
h1 {
width: 400px;
text-align: center;
color: white;
background-color: #557799;
padding: 10px;
-moz-box-shadow: 3px 3px 4px #AAA;
-webkit-box-shadow: 3px 3px 4px #AAA;
box-shadow: 3px 3px 4px #AAA;
border-radius: 10px;
-moz-border-radius: 10px;
text-shadow: 2px 2px 2px black;
}
h2 {
font-size: 150%;
margin-top: 40px;
padding-top: 5px;
border-top: 5px solid lightgray;
}
h3 {
margin-left: 10px;
margin-top: 30px;
}
a {
text-decoration: underline;
color: #D93544;
}
.logo {
float: right;
}
.metadata {
}
.summary {
margin-bottom: 20px;
}
.reportInfo {
font-size: 110%;
}
.allPackages {
font-weight: bold;
}
.fileHeader {
font-size: 120%;
font-weight: bold;
}
.tableHeader {
font-weight: bold;
}
.number {
text-align: center;
}
.priority1, .priority2, .priority3 {
font-weight: bold;
text-align: center;
color: #990000;
}
.priority1 {
background-color: #FFAAAA;
}
.priority2 {
background-color: #FFCCAA;
}
.priority3 {
background-color: #FFEEAA;
}
.ruleName {
font-weight: bold;
color: black;
text-align: left;
}
.violationInfo {
margin-bottom: 2px;
margin-top: 2px;
}
.violationInfoPrefix {
font-size: 60%;
width: 30px;
color: #a9a9a9;
padding-right: 4px;
}
.sourceCode {
font-family: Arial, sans-serif;
font-size: 80%;
color: #444444;
}
.violationMessage {
font-style: italic;
font-size: 80%;
color: black;
}
.ruleDescriptions {
font-size: 85%;
}
.version {
margin-top: 1px;
}
table {
border: 2px solid gray;
border-collapse: collapse;
-moz-box-shadow: 3px 3px 4px #AAA;
-webkit-box-shadow: 3px 3px 4px #AAA;
box-shadow: 3px 3px 4px #AAA;
}
td, th {
border: 1px solid #D3D3D3;
padding: 4px 20px 4px 20px;
}
th {
text-shadow: 2px 2px 2px white;
}
th {
border-bottom: 1px solid gray;
background-color: #DDDDFF;
}
em, .em {
font-weight: bold;
}</style></head><body><img class='logo' src='http://codenarc.sourceforge.net/images/codenarc-logo.png' alt='CodeNarc' align='right'/><h1>CodeNarc Report</h1><div class='metadata'><table><tr><td class='em'>Report title:</td><td>Sample Project</td></tr><tr><td class='em'>Date:</td><td>Feb 17, 2015 8:58:07 PM</td></tr><tr><td class='em'>Generated with:</td><td><a href='http://www.codenarc.org'>CodeNarc v0.23</a></td></tr></table></div><div class='summary'><h2>Summary</h2><table><tr class='tableHeader'><th>Package</th><th>Total Files</th><th>Files with Violations</th><th>Priority 1</th><th>Priority 2</th><th>Priority 3</th></tr><tr><td class='allPackages'>All Packages</td><td class='number'>10</td><td class='number'>6</td><td class='priority1'>-</td><td class='priority2'>-</td><td class='priority3'>8</td></tr><tr><td><a href='#<Root>'><Root></a></td><td class='number'>7</td><td class='number'>3</td><td class='priority1'>-</td><td class='priority2'>-</td><td class='priority3'>3</td></tr><tr><td><a href='#io'>io</a></td><td class='number'>3</td><td class='number'>3</td><td class='priority1'>-</td><td class='priority2'>-</td><td class='priority3'>5</td></tr></table></div><div class='summary'><a name='<Root>'> </a><h2 class='packageHeader'>Package: <Root></h2></div><div class='summary'><h3 class='fileHeader'>➥ ModifiersUtilTest.groovy</h3><table border='1'><tr class='tableHeader'><th>Rule Name</th><th>Priority</th><th>Line #</th><th>Source Line / Message</th></tr><tr><td><a href='#MisorderedStaticImports'>MisorderedStaticImports</a></td><td class='priority3'>3</td><td class='number'>20</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>import static org.codenarc.test.TestUtil.shouldFailWithM..geContaining</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Static imports should appear before normal imports</span></p></td></tr></table></div><div class='summary'><h3 class='fileHeader'>➥ PropertyUtilTest.groovy</h3><table border='1'><tr class='tableHeader'><th>Rule Name</th><th>Priority</th><th>Line #</th><th>Source Line / Message</th></tr><tr><td><a href='#MisorderedStaticImports'>MisorderedStaticImports</a></td><td class='priority3'>3</td><td class='number'>22</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>import static org.codenarc.test.TestUtil.shouldFail</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Static imports should appear before normal imports</span></p></td></tr></table></div><div class='summary'><h3 class='fileHeader'>➥ SourceCodeUtilTest.groovy</h3><table border='1'><tr class='tableHeader'><th>Rule Name</th><th>Priority</th><th>Line #</th><th>Source Line / Message</th></tr><tr><td><a href='#MisorderedStaticImports'>MisorderedStaticImports</a></td><td class='priority3'>3</td><td class='number'>27</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>import static org.codenarc.test.TestUtil.shouldFail</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Static imports should appear before normal imports</span></p></td></tr></table></div><div class='summary'><a name='io'> </a><h2 class='packageHeader'>Package: io</h2></div><div class='summary'><h3 class='fileHeader'>➥ ClassPathResourceTest.groovy</h3><table border='1'><tr class='tableHeader'><th>Rule Name</th><th>Priority</th><th>Line #</th><th>Source Line / Message</th></tr><tr><td><a href='#MisorderedStaticImports'>MisorderedStaticImports</a></td><td class='priority3'>3</td><td class='number'>21</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>import static org.codenarc.test.TestUtil.shouldFail</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Static imports should appear before normal imports</span></p></td></tr><tr><td><a href='#MisorderedStaticImports'>MisorderedStaticImports</a></td><td class='priority3'>3</td><td class='number'>22</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>import static org.codenarc.test.TestUtil.shouldFailWithM..geContaining</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Static imports should appear before normal imports</span></p></td></tr></table></div><div class='summary'><h3 class='fileHeader'>➥ DefaultResourceFactoryTest.groovy</h3><table border='1'><tr class='tableHeader'><th>Rule Name</th><th>Priority</th><th>Line #</th><th>Source Line / Message</th></tr><tr><td><a href='#MisorderedStaticImports'>MisorderedStaticImports</a></td><td class='priority3'>3</td><td class='number'>22</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>import static org.codenarc.test.TestUtil.shouldFailWithM..geContaining</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Static imports should appear before normal imports</span></p></td></tr></table></div><div class='summary'><h3 class='fileHeader'>➥ UrlResourceTest.groovy</h3><table border='1'><tr class='tableHeader'><th>Rule Name</th><th>Priority</th><th>Line #</th><th>Source Line / Message</th></tr><tr><td><a href='#MisorderedStaticImports'>MisorderedStaticImports</a></td><td class='priority3'>3</td><td class='number'>21</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>import static org.codenarc.test.TestUtil.shouldFail</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Static imports should appear before normal imports</span></p></td></tr><tr><td><a href='#MisorderedStaticImports'>MisorderedStaticImports</a></td><td class='priority3'>3</td><td class='number'>22</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>import static org.codenarc.test.TestUtil.shouldFailWithM..geContaining</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Static imports should appear before normal imports</span></p></td></tr></table></div><div class='summary'><h2>Rule Descriptions</h2><table border='1'><tr class='tableHeader'><th class='ruleDescriptions'>#</th><th class='ruleDescriptions'>Rule Name</th><th class='ruleDescriptions'>Description</th></tr><tr class='ruleDescriptions'><td><a name='AssertWithinFinallyBlock'></a><span class='ruleIndex'>1</span></td><td class='ruleName priority2'>AssertWithinFinallyBlock</td><td>Checks for <em>assert</em> statements within a <em>finally</em> block. An <em>assert</em> can throw an exception, hiding the original exception, if there is one.</td></tr><tr class='ruleDescriptions'><td><a name='AssignmentInConditional'></a><span class='ruleIndex'>2</span></td><td class='ruleName priority2'>AssignmentInConditional</td><td>An assignment operator (=) was used in a conditional test. This is usually a typo, and the comparison operator (==) was intended.</td></tr><tr class='ruleDescriptions'><td><a name='BigDecimalInstantiation'></a><span class='ruleIndex'>3</span></td><td class='ruleName priority2'>BigDecimalInstantiation</td><td>Checks for calls to the <em>BigDecimal</em> constructors that take a <em>double</em> parameter, which may result in an unexpected <em>BigDecimal</em> value.</td></tr><tr class='ruleDescriptions'><td><a name='BitwiseOperatorInConditional'></a><span class='ruleIndex'>4</span></td><td class='ruleName priority2'>BitwiseOperatorInConditional</td><td>Checks for bitwise operations in conditionals, if you need to do a bitwise operation then it is best practive to extract a temp variable.</td></tr><tr class='ruleDescriptions'><td><a name='BooleanGetBoolean'></a><span class='ruleIndex'>5</span></td><td class='ruleName priority2'>BooleanGetBoolean</td><td>This 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'].</td></tr><tr class='ruleDescriptions'><td><a name='BrokenNullCheck'></a><span class='ruleIndex'>6</span></td><td class='ruleName priority2'>BrokenNullCheck</td><td>Looks for faulty checks for null that can cause a <em>NullPointerException</em>.</td></tr><tr class='ruleDescriptions'><td><a name='BrokenOddnessCheck'></a><span class='ruleIndex'>7</span></td><td class='ruleName priority2'>BrokenOddnessCheck</td><td>The 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.</td></tr><tr class='ruleDescriptions'><td><a name='ClassForName'></a><span class='ruleIndex'>8</span></td><td class='ruleName priority2'>ClassForName</td><td>Using 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.</td></tr><tr class='ruleDescriptions'><td><a name='ComparisonOfTwoConstants'></a><span class='ruleIndex'>9</span></td><td class='ruleName priority2'>ComparisonOfTwoConstants</td><td>Checks for expressions where a comparison operator or <em>equals()</em> or <em>compareTo()</em> is used to compare two constants to each other or two literals that contain only constant values., e.g.: <em>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]</em>.</td></tr><tr class='ruleDescriptions'><td><a name='ComparisonWithSelf'></a><span class='ruleIndex'>10</span></td><td class='ruleName priority2'>ComparisonWithSelf</td><td>Checks for expressions where a comparison operator or <em>equals()</em> or <em>compareTo()</em> is used to compare a variable to itself, e.g.: <em>x == x, x != x, x <=> x, x < x, x =>= x, x.equals(x) or x.compareTo(x)</em>, where <em>x</em> is a variable.</td></tr><tr class='ruleDescriptions'><td><a name='ConstantAssertExpression'></a><span class='ruleIndex'>11</span></td><td class='ruleName priority3'>ConstantAssertExpression</td><td>Checks for <em>assert</em> statements where the assert boolean condition expression is a constant or literal value.</td></tr><tr class='ruleDescriptions'><td><a name='ConstantIfExpression'></a><span class='ruleIndex'>12</span></td><td class='ruleName priority2'>ConstantIfExpression</td><td>Checks for <em>if</em> statements with a constant value for the if expression, such as <em>true</em>, <em>false</em>, <em>null</em>, or a literal constant value.</td></tr><tr class='ruleDescriptions'><td><a name='ConstantTernaryExpression'></a><span class='ruleIndex'>13</span></td><td class='ruleName priority2'>ConstantTernaryExpression</td><td>Checks for ternary expressions with a constant value for the boolean expression, such as <em>true</em>, <em>false</em>, <em>null</em>, or a literal constant value.</td></tr><tr class='ruleDescriptions'><td><a name='DeadCode'></a><span class='ruleIndex'>14</span></td><td class='ruleName priority2'>DeadCode</td><td>Dead 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.</td></tr><tr class='ruleDescriptions'><td><a name='DoubleNegative'></a><span class='ruleIndex'>15</span></td><td class='ruleName priority2'>DoubleNegative</td><td>There is no point in using a double negative, it is always positive. For instance <em>!!x</em> can always be simplified to x. And <em>!(!x)</em> can as well.</td></tr><tr class='ruleDescriptions'><td><a name='DuplicateCaseStatement'></a><span class='ruleIndex'>16</span></td><td class='ruleName priority2'>DuplicateCaseStatement</td><td>Check for duplicate <em>case</em> statements in a <em>switch</em> block, such as two equal integers or strings.</td></tr><tr class='ruleDescriptions'><td><a name='DuplicateImport'></a><span class='ruleIndex'>17</span></td><td class='ruleName priority3'>DuplicateImport</td><td>Duplicate import statements are unnecessary.</td></tr><tr class='ruleDescriptions'><td><a name='DuplicateMapKey'></a><span class='ruleIndex'>18</span></td><td class='ruleName priority2'>DuplicateMapKey</td><td>A map literal is created with duplicated key. The map entry will be overwritten.</td></tr><tr class='ruleDescriptions'><td><a name='DuplicateSetValue'></a><span class='ruleIndex'>19</span></td><td class='ruleName priority2'>DuplicateSetValue</td><td>A Set literal is created with duplicate constant value. A set cannot contain two elements with the same value.</td></tr><tr class='ruleDescriptions'><td><a name='EmptyCatchBlock'></a><span class='ruleIndex'>20</span></td><td class='ruleName priority2'>EmptyCatchBlock</td><td>In most cases, exceptions should not be caught and ignored (swallowed).</td></tr><tr class='ruleDescriptions'><td><a name='EmptyClass'></a><span class='ruleIndex'>21</span></td><td class='ruleName priority2'>EmptyClass</td><td>Reports classes without methods, fields or properties. Why would you need a class like this?</td></tr><tr class='ruleDescriptions'><td><a name='EmptyElseBlock'></a><span class='ruleIndex'>22</span></td><td class='ruleName priority2'>EmptyElseBlock</td><td>Empty <em>else</em> blocks are confusing and serve no purpose.</td></tr><tr class='ruleDescriptions'><td><a name='EmptyFinallyBlock'></a><span class='ruleIndex'>23</span></td><td class='ruleName priority2'>EmptyFinallyBlock</td><td>Empty <em>finally</em> blocks are confusing and serve no purpose.</td></tr><tr class='ruleDescriptions'><td><a name='EmptyForStatement'></a><span class='ruleIndex'>24</span></td><td class='ruleName priority2'>EmptyForStatement</td><td>Empty <em>for</em> statements are confusing and serve no purpose.</td></tr><tr class='ruleDescriptions'><td><a name='EmptyIfStatement'></a><span class='ruleIndex'>25</span></td><td class='ruleName priority2'>EmptyIfStatement</td><td>Empty <em>if</em> statements are confusing and serve no purpose.</td></tr><tr class='ruleDescriptions'><td><a name='EmptyInstanceInitializer'></a><span class='ruleIndex'>26</span></td><td class='ruleName priority2'>EmptyInstanceInitializer</td><td>An empty class instance initializer was found. It is safe to remove it.</td></tr><tr class='ruleDescriptions'><td><a name='EmptyMethod'></a><span class='ruleIndex'>27</span></td><td class='ruleName priority2'>EmptyMethod</td><td>A method was found without an implementation. If the method is overriding or implementing a parent method, then mark it with the @Override annotation.</td></tr><tr class='ruleDescriptions'><td><a name='EmptyStaticInitializer'></a><span class='ruleIndex'>28</span></td><td class='ruleName priority2'>EmptyStaticInitializer</td><td>An empty static initializer was found. It is safe to remove it.</td></tr><tr class='ruleDescriptions'><td><a name='EmptySwitchStatement'></a><span class='ruleIndex'>29</span></td><td class='ruleName priority2'>EmptySwitchStatement</td><td>Empty <em>switch</em> statements are confusing and serve no purpose.</td></tr><tr class='ruleDescriptions'><td><a name='EmptySynchronizedStatement'></a><span class='ruleIndex'>30</span></td><td class='ruleName priority2'>EmptySynchronizedStatement</td><td>Empty <em>synchronized</em> statements are confusing and serve no purpose.</td></tr><tr class='ruleDescriptions'><td><a name='EmptyTryBlock'></a><span class='ruleIndex'>31</span></td><td class='ruleName priority2'>EmptyTryBlock</td><td>Empty <em>try</em> blocks are confusing and serve no purpose.</td></tr><tr class='ruleDescriptions'><td><a name='EmptyWhileStatement'></a><span class='ruleIndex'>32</span></td><td class='ruleName priority2'>EmptyWhileStatement</td><td>Empty <em>while</em> statements are confusing and serve no purpose.</td></tr><tr class='ruleDescriptions'><td><a name='EqualsAndHashCode'></a><span class='ruleIndex'>33</span></td><td class='ruleName priority2'>EqualsAndHashCode</td><td>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.</td></tr><tr class='ruleDescriptions'><td><a name='EqualsOverloaded'></a><span class='ruleIndex'>34</span></td><td class='ruleName priority2'>EqualsOverloaded</td><td>The 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.</td></tr><tr class='ruleDescriptions'><td><a name='ExplicitGarbageCollection'></a><span class='ruleIndex'>35</span></td><td class='ruleName priority2'>ExplicitGarbageCollection</td><td>Calls 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.</td></tr><tr class='ruleDescriptions'><td><a name='ForLoopShouldBeWhileLoop'></a><span class='ruleIndex'>36</span></td><td class='ruleName priority3'>ForLoopShouldBeWhileLoop</td><td>A for loop without an init and update statement can be simplified to a while loop.</td></tr><tr class='ruleDescriptions'><td><a name='HardCodedWindowsFileSeparator'></a><span class='ruleIndex'>37</span></td><td class='ruleName priority2'>HardCodedWindowsFileSeparator</td><td>This 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.</td></tr><tr class='ruleDescriptions'><td><a name='HardCodedWindowsRootDirectory'></a><span class='ruleIndex'>38</span></td><td class='ruleName priority2'>HardCodedWindowsRootDirectory</td><td>This rule find cases where a <em>File</em> object is constructed with a windows-based path. This is not portable, and using the <em>File.listRoots()</em> method is a better alternative.</td></tr><tr class='ruleDescriptions'><td><a name='ImportFromSamePackage'></a><span class='ruleIndex'>39</span></td><td class='ruleName priority3'>ImportFromSamePackage</td><td>An import of a class that is within the same package is unnecessary.</td></tr><tr class='ruleDescriptions'><td><a name='ImportFromSunPackages'></a><span class='ruleIndex'>40</span></td><td class='ruleName priority2'>ImportFromSunPackages</td><td>Avoid importing anything from the 'sun.*' packages. These packages are not portable and are likely to change.</td></tr><tr class='ruleDescriptions'><td><a name='IntegerGetInteger'></a><span class='ruleIndex'>41</span></td><td class='ruleName priority2'>IntegerGetInteger</td><td>This 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'].</td></tr><tr class='ruleDescriptions'><td><a name='MisorderedStaticImports'></a><span class='ruleIndex'>42</span></td><td class='ruleName priority3'>MisorderedStaticImports</td><td>Static imports should never be declared after nonstatic imports.</td></tr><tr class='ruleDescriptions'><td><a name='MultipleUnaryOperators'></a><span class='ruleIndex'>43</span></td><td class='ruleName priority2'>MultipleUnaryOperators</td><td>Checks for multiple consecutive unary operators. These are confusing, and are likely typos and bugs.</td></tr><tr class='ruleDescriptions'><td><a name='NoWildcardImports'></a><span class='ruleIndex'>44</span></td><td class='ruleName priority3'>NoWildcardImports</td><td>Wildcard imports, static or otherwise, should not be used.</td></tr><tr class='ruleDescriptions'><td><a name='RandomDoubleCoercedToZero'></a><span class='ruleIndex'>45</span></td><td class='ruleName priority2'>RandomDoubleCoercedToZero</td><td>The 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.</td></tr><tr class='ruleDescriptions'><td><a name='RemoveAllOnSelf'></a><span class='ruleIndex'>46</span></td><td class='ruleName priority2'>RemoveAllOnSelf</td><td>Don't use <em>removeAll</em> to clear a collection. If you want to remove all elements from a collection c, use c.clear, not c.removeAll(c). Calling <em>c.removeAll(c)</em> to clear a collection is less clear, susceptible to errors from typos, less efficient and for some collections, might throw a <em>ConcurrentModificationException</em>.</td></tr><tr class='ruleDescriptions'><td><a name='ReturnFromFinallyBlock'></a><span class='ruleIndex'>47</span></td><td class='ruleName priority2'>ReturnFromFinallyBlock</td><td>Returning from a <em>finally</em> block is confusing and can hide the original exception.</td></tr><tr class='ruleDescriptions'><td><a name='ThrowExceptionFromFinallyBlock'></a><span class='ruleIndex'>48</span></td><td class='ruleName priority2'>ThrowExceptionFromFinallyBlock</td><td>Throwing an exception from a <em>finally</em> block is confusing and can hide the original exception.</td></tr><tr class='ruleDescriptions'><td><a name='UnnecessaryGroovyImport'></a><span class='ruleIndex'>49</span></td><td class='ruleName priority3'>UnnecessaryGroovyImport</td><td>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>.</td></tr><tr class='ruleDescriptions'><td><a name='UnusedImport'></a><span class='ruleIndex'>50</span></td><td class='ruleName priority3'>UnusedImport</td><td>Imports for a class that is never referenced within the source file is unnecessary.</td></tr></table></div></body></html>
|