<?xml version='1.0'?>
<CodeNarc url='http://www.codenarc.org' version='0.18'><Report timestamp='Dec 9, 2012 8:02:02 PM'/><Project title='Sample Project'><SourceDirectory>samples\src</SourceDirectory></Project><PackageSummary totalFiles='7' filesWithViolations='4' priority1='0' priority2='9' priority3='3'></PackageSummary><Package path='org' totalFiles='7' filesWithViolations='4' priority1='0' priority2='9' priority3='3'></Package><Package path='org/codenarc' totalFiles='7' filesWithViolations='4' priority1='0' priority2='9' priority3='3'></Package><Package path='org/codenarc/sample' totalFiles='7' filesWithViolations='4' priority1='0' priority2='9' priority3='3'></Package><Package path='org/codenarc/sample/domain' totalFiles='2' filesWithViolations='1' priority1='0' priority2='2' priority3='2'><File name='SampleDomain.groovy'><Violation ruleName='ImportFromSamePackage' priority='3' lineNumber='3'><SourceLine><![CDATA[import org.codenarc.sample.domain.OtherDomain]]></SourceLine></Violation><Violation ruleName='DuplicateImport' priority='3' lineNumber='5'><SourceLine><![CDATA[import org.codenarc.sample.other.Other]]></SourceLine></Violation><Violation ruleName='EmptyIfStatement' priority='2' lineNumber='20'><SourceLine><![CDATA[if (name) {]]></SourceLine><Message><![CDATA[The if statement is empty]]></Message></Violation><Violation ruleName='EmptyElseBlock' priority='2' lineNumber='23'><SourceLine><![CDATA[else {]]></SourceLine><Message><![CDATA[The else block is empty]]></Message></Violation></File></Package><Package path='org/codenarc/sample/other' totalFiles='1' filesWithViolations='0' priority1='0' priority2='0' priority3='0'></Package><Package path='org/codenarc/sample/service' totalFiles='4' filesWithViolations='3' priority1='0' priority2='7' priority3='1'><File name='NewService.groovy'><Violation ruleName='EmptyForStatement' priority='2' lineNumber='12'><SourceLine><![CDATA[for(int i=0; i < values.size(); i++) {]]></SourceLine><Message><![CDATA[The for statement is empty]]></Message></Violation><Violation ruleName='EmptyWhileStatement' priority='2' lineNumber='18'><SourceLine><![CDATA[while (!values.empty) {]]></SourceLine><Message><![CDATA[The while statement is empty]]></Message></Violation></File><File name='OtherService.groovy'><Violation ruleName='EmptyTryBlock' priority='2' lineNumber='10'><SourceLine><![CDATA[try {]]></SourceLine><Message><![CDATA[The try block is empty]]></Message></Violation><Violation ruleName='EmptyFinallyBlock' priority='2' lineNumber='13'><SourceLine><![CDATA[finally {]]></SourceLine><Message><![CDATA[The finally block is empty]]></Message></Violation><Violation ruleName='ReturnFromFinallyBlock' priority='2' lineNumber='24'><SourceLine><![CDATA[return]]></SourceLine><Message><![CDATA[finally statements cannot return a value]]></Message></Violation></File><File name='SampleService.groovy'><Violation ruleName='UnusedImport' priority='3' lineNumber='3'><SourceLine><![CDATA[import org.codenarc.sample.domain.SampleDomain]]></SourceLine><Message><![CDATA[The [org.codenarc.sample.domain.SampleDomain] import is never referenced]]></Message></Violation><Violation ruleName='EmptyCatchBlock' priority='2' lineNumber='19'><SourceLine><![CDATA[} catch(Throwable t) {]]></SourceLine><Message><![CDATA[The catch block is empty]]></Message></Violation><Violation ruleName='ThrowExceptionFromFinallyBlock' priority='2' lineNumber='30'><SourceLine><![CDATA[throw new Exception('bad stuff')]]></SourceLine><Message><![CDATA[Throwing an exception from a finally block can hide an underlying error]]></Message></Violation></File></Package><Rules><Rule name='AssertWithinFinallyBlock'><Description><![CDATA[Checks for assert statements within a finally block. An assert can throw an exception, hiding the original exception, if there is one.]]></Description></Rule><Rule name='AssignmentInConditional'><Description><![CDATA[An assignment operator (=) was used in a conditional test. This is usually a typo, and the comparison operator (==) was intended.]]></Description></Rule><Rule name='BigDecimalInstantiation'><Description><![CDATA[Checks for calls to the BigDecimal constructors that take a double parameter, which may result in an unexpected BigDecimal value.]]></Description></Rule><Rule name='BitwiseOperatorInConditional'><Description><![CDATA[Checks for bitwise operations in conditionals, if you need to do a bitwise operation then it is best practive to extract a temp variable.]]></Description></Rule><Rule name='BooleanGetBoolean'><Description><![CDATA[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'].]]></Description></Rule><Rule name='BrokenNullCheck'><Description><![CDATA[Looks for faulty checks for null that can cause a NullPointerException.]]></Description></Rule><Rule name='BrokenOddnessCheck'><Description><![CDATA[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.]]></Description></Rule><Rule name='ClassForName'><Description><![CDATA[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.]]></Description></Rule><Rule name='ComparisonOfTwoConstants'><Description><![CDATA[Checks 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], where x is a variable.]]></Description></Rule><Rule name='ComparisonWithSelf'><Description><![CDATA[Checks 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.]]></Description></Rule><Rule name='ConstantAssertExpression'><Description><![CDATA[Checks for assert statements where the assert boolean condition expression is a constant or literal value.]]></Description></Rule><Rule name='ConstantIfExpression'><Description><![CDATA[Checks for if statements with a constant value for the if expression, such as true, false, null, or a literal constant value.]]></Description></Rule><Rule name='ConstantTernaryExpression'><Description><![CDATA[Checks for ternary expressions with a constant value for the boolean expression, such as true, false, null, or a literal constant value.]]></Description></Rule><Rule name='DeadCode'><Description><![CDATA[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.]]></Description></Rule><Rule name='DoubleNegative'><Description><![CDATA[There 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.]]></Description></Rule><Rule name='DuplicateCaseStatement'><Description><![CDATA[Check for duplicate case statements in a switch block, such as two equal integers or strings.]]></Description></Rule><Rule name='DuplicateImport'><Description><![CDATA[Duplicate import statements are unnecessary.]]></Description></Rule><Rule name='DuplicateMapKey'><Description><![CDATA[A map literal is created with duplicated key. The map entry will be overwritten.]]></Description></Rule><Rule name='DuplicateSetValue'><Description><![CDATA[A Set literal is created with duplicate constant value. A set cannot contain two elements with the same value.]]></Description></Rule><Rule name='EmptyCatchBlock'><Description><![CDATA[In most cases, exceptions should not be caught and ignored (swallowed).]]></Description></Rule><Rule name='EmptyElseBlock'><Description><![CDATA[Empty else blocks are confusing and serve no purpose.]]></Description></Rule><Rule name='EmptyFinallyBlock'><Description><![CDATA[Empty finally blocks are confusing and serve no purpose.]]></Description></Rule><Rule name='EmptyForStatement'><Description><![CDATA[Empty for statements are confusing and serve no purpose.]]></Description></Rule><Rule name='EmptyIfStatement'><Description><![CDATA[Empty if statements are confusing and serve no purpose.]]></Description></Rule><Rule name='EmptyInstanceInitializer'><Description><![CDATA[An empty class instance initializer was found. It is safe to remove it.]]></Description></Rule><Rule name='EmptyMethod'><Description><![CDATA[A method was found without an implementation. If the method is overriding or implementing a parent method, then mark it with the @Override annotation.]]></Description></Rule><Rule name='EmptyStaticInitializer'><Description><![CDATA[An empty static initializer was found. It is safe to remove it.]]></Description></Rule><Rule name='EmptySwitchStatement'><Description><![CDATA[Empty switch statements are confusing and serve no purpose.]]></Description></Rule><Rule name='EmptySynchronizedStatement'><Description><![CDATA[Empty synchronized statements are confusing and serve no purpose.]]></Description></Rule><Rule name='EmptyTryBlock'><Description><![CDATA[Empty try blocks are confusing and serve no purpose.]]></Description></Rule><Rule name='EmptyWhileStatement'><Description><![CDATA[Empty while statements are confusing and serve no purpose.]]></Description></Rule><Rule name='EqualsAndHashCode'><Description><![CDATA[If either the equals(Object) or the hashCode() methods are overridden within a class, then both must be overridden.]]></Description></Rule><Rule name='EqualsOverloaded'><Description><![CDATA[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.]]></Description></Rule><Rule name='ExplicitGarbageCollection'><Description><![CDATA[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.]]></Description></Rule><Rule name='ForLoopShouldBeWhileLoop'><Description><![CDATA[A for loop without an init and update statement can be simplified to a while loop.]]></Description></Rule><Rule name='HardCodedWindowsFileSeparator'><Description><![CDATA[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.]]></Description></Rule><Rule name='HardCodedWindowsRootDirectory'><Description><![CDATA[This 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.]]></Description></Rule><Rule name='ImportFromSamePackage'><Description><![CDATA[An import of a class that is within the same package is unnecessary.]]></Description></Rule><Rule name='ImportFromSunPackages'><Description><![CDATA[Avoid importing anything from the 'sun.*' packages. These packages are not portable and are likely to change.]]></Description></Rule><Rule name='IntegerGetInteger'><Description><![CDATA[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'].]]></Description></Rule><Rule name='MisorderedStaticImports'><Description><![CDATA[Static imports should never be declared after nonstatic imports.]]></Description></Rule><Rule name='RandomDoubleCoercedToZero'><Description><![CDATA[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.]]></Description></Rule><Rule name='RemoveAllOnSelf'><Description><![CDATA[Don'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.]]></Description></Rule><Rule name='ReturnFromFinallyBlock'><Description><![CDATA[Returning from a finally block is confusing and can hide the original exception.]]></Description></Rule><Rule name='ThrowExceptionFromFinallyBlock'><Description><![CDATA[Throwing an exception from a finally block is confusing and can hide the original exception.]]></Description></Rule><Rule name='UnnecessaryGroovyImport'><Description><![CDATA[A Groovy file does not need to include an import for classes from java.lang, java.util, java.io, java.net, groovy.lang and groovy.util, as well as the classes java.math.BigDecimal and java.math.BigInteger.]]></Description></Rule><Rule name='UnusedImport'><Description><![CDATA[Imports for a class that is never referenced within the source file is unnecessary.]]></Description></Rule></Rules></CodeNarc>