4j.sanity4j.1.0.7.source-code.sanity4j_pmd_rules.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sanity4j Show documentation
Show all versions of sanity4j Show documentation
Sanity4J was created to simplify running multiple static code
analysis tools on the Java projects. It provides a single entry
point to run all the selected tools and produce a consolidated
report, which presents all findings in an easily accessible
manner.
<?xml version="1.0"?> <ruleset name ="Sanity4J Development Rules" xsi:schemaLocation ="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation ="http://pmd.sf.net/ruleset_xml_schema.xsd" xmlns ="http://pmd.sf.net/ruleset/1.0.0" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"> <description> This is the Sanity4J rule set, which adds to the in-built PMD rules, with customised priorities. Where there is overlap with another tool (FindBugs, Checkstyle etc.), the other tool is usually used in preference to PMD. </description> <rule name ="IncorrectlyLoggedException" since ="4.2.2" message ="Incorrectly logged exception" class ="net.sourceforge.pmd.rules.XPathRule" externalInfoUrl =""> <description> Do not rely on an Exception's toString() representation when logging errors, as it may not contain enough information (e.g. the Stacktrace). Use the log.error(String, Throwable) method instead. </description> <priority>3</priority> <properties> <property name="xpath"> <value> <![CDATA[ //CatchStatement/Block/BlockStatement/Statement[ ends-with(StatementExpression/PrimaryExpression/PrimaryPrefix/Name/@Image, '.error') ][ StatementExpression/PrimaryExpression/PrimarySuffix/Arguments/ArgumentList/Expression/AdditiveExpression/PrimaryExpression/PrimaryPrefix/Name/@Image = ../../../FormalParameter/VariableDeclaratorId/@Image ] ]]> </value> </property> </properties> <example> <![CDATA[ public class MyClass { private static final Logger log = Logger.get(MyClass.class); public byte[] getData() { try { return StreamUtils.read(new FileInputStream("data")); } catch (IOException e) { //log.error("Bad" + e); //log.error("Ok" + e.getMessage()); log.error("Better", e); } } } ]]> </example> </rule> <!-- ************************************************************************* In-built PMD rules, with customised priorities. Where there is overlap with another tool (FindBugs, Checkstyle etc.), the other tool is usually used in preference to PMD. ************************************************************************** --> <!-- Basic JSF rules --> <!-- Unused (we don't use JSF) <rule ref="rulesets/basic-jsf.xml/DontNestJsfInJstlIteration"><priority>#</priority></rule> --> <!-- Basic JSP rules --> <!-- Unused (fail when accidentally run against java source) <rule ref="rulesets/basic-jsp.xml/NoLongScripts"><priority>4</priority></rule> <rule ref="rulesets/basic-jsp.xml/NoScriptlets"><priority>4</priority></rule> <rule ref="rulesets/basic-jsp.xml/NoInlineStyleInformation"><priority>4</priority></rule> <rule ref="rulesets/basic-jsp.xml/NoClassAttribute"><priority>4</priority></rule> <rule ref="rulesets/basic-jsp.xml/NoJspForward"><priority>4</priority></rule> <rule ref="rulesets/basic-jsp.xml/IframeMissingSrcAttribute"><priority>4</priority></rule> <rule ref="rulesets/basic-jsp.xml/NoHtmlComments"><priority>4</priority></rule> <rule ref="rulesets/basic-jsp.xml/DuplicateJspImports"><priority>4</priority></rule> <rule ref="rulesets/basic-jsp.xml/JspEncoding"><priority>4</priority></rule> --> <!-- Basic Rules --> <rule ref="rulesets/basic.xml/EmptyCatchBlock"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/EmptyIfStmt"><priority>2</priority></rule> <rule ref="rulesets/basic.xml/EmptyWhileStmt"><priority>2</priority></rule> <rule ref="rulesets/basic.xml/EmptyTryBlock"><priority>2</priority></rule> <rule ref="rulesets/basic.xml/EmptyFinallyBlock"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/EmptySwitchStatements"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/JumbledIncrementer"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"><priority>4</priority></rule> <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"><priority>4</priority></rule> <rule ref="rulesets/basic.xml/DoubleCheckedLocking"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"><priority>3</priority></rule> <!-- Using Findbugs rule <rule ref="rulesets/basic.xml/EmptySynchronizedBlock"><priority>2</priority></rule> --> <rule ref="rulesets/basic.xml/UnnecessaryReturn"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/EmptyStaticInitializer"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/UnconditionalIfStatement"><priority>2</priority></rule> <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"><priority>3</priority></rule> <!-- Using Findbugs rule <rule ref="rulesets/basic.xml/BooleanInstantiation"><priority>3</priority></rule> --> <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"><priority>4</priority></rule> <rule ref="rulesets/basic.xml/CollapsibleIfStatements"><priority>4</priority></rule> <rule ref="rulesets/basic.xml/UselessOverridingMethod"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/ClassCastExceptionWithToArray"><priority>2</priority></rule> <rule ref="rulesets/basic.xml/AvoidDecimalLiteralsInBigDecimalConstructor"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/UselessOperationOnImmutable"><priority>2</priority></rule> <rule ref="rulesets/basic.xml/MisplacedNullCheck"><priority>2</priority></rule> <rule ref="rulesets/basic.xml/UnusedNullCheckInEquals"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/AvoidThreadGroup"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/BrokenNullCheck"><priority>2</priority></rule> <rule ref="rulesets/basic.xml/BigIntegerInstantiation"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/AvoidUsingOctalValues"><priority>3</priority></rule> <rule ref="rulesets/basic.xml/AvoidUsingHardCodedIP"><priority>2</priority></rule> <rule ref="rulesets/basic.xml/CheckResultSet"><priority>2</priority></rule> <rule ref="rulesets/basic.xml/AvoidMultipleUnaryOperators"><priority>2</priority></rule> <!-- Braces Rules --> <!-- Using Checkstyle for these <rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"><priority>4</priority></rule> <rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"><priority>4</priority></rule> <rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"><priority>4</priority></rule> <rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"><priority>4</priority></rule> --> <!-- Clone Implementation Rules --> <!-- Using Findbugs rule <rule ref="rulesets/clone.xml/ProperCloneImplementation"><priority>2</priority></rule> --> <rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"><priority>3</priority></rule> <!-- Using Findbugs rule <rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"><priority>3</priority></rule> --> <!-- Code Size Rules --> <rule ref="rulesets/codesize.xml/NPathComplexity"><priority>5</priority></rule> <rule ref="rulesets/codesize.xml/ExcessiveMethodLength"><priority>5</priority></rule> <rule ref="rulesets/codesize.xml/ExcessiveParameterList"><priority>5</priority></rule> <rule ref="rulesets/codesize.xml/ExcessiveClassLength"><priority>5</priority></rule> <rule ref="rulesets/codesize.xml/CyclomaticComplexity"><priority>4</priority></rule> <rule ref="rulesets/codesize.xml/ExcessivePublicCount"><priority>5</priority></rule> <rule ref="rulesets/codesize.xml/TooManyFields"><priority>5</priority></rule> <rule ref="rulesets/codesize.xml/NcssMethodCount"><priority>5</priority></rule> <rule ref="rulesets/codesize.xml/NcssTypeCount"><priority>5</priority></rule> <rule ref="rulesets/codesize.xml/NcssConstructorCount"><priority>5</priority></rule> <rule ref="rulesets/codesize.xml/TooManyMethods"> <priority>5</priority> <properties> <property name="xpath"> <value> <![CDATA[ //ClassOrInterfaceDeclaration/ClassOrInterfaceBody[ count( descendant::MethodDeclarator[ not( starts-with(@Image,'get') or starts-with(@Image,'set') ) ] ) > $maxmethods ][ not( ../ExtendsList/ClassOrInterfaceType[typeof(@Image, 'junit.framework.TestCase','TestCase') or //MarkerAnnotation/Name[typeof(@Image, 'org.junit.Test', 'Test')]] ) ] ]]> </value> </property> </properties> </rule> <!-- Controversial Rules --> <rule ref="rulesets/controversial.xml/UnnecessaryConstructor"><priority>3</priority></rule> <!-- unused <rule ref="rulesets/controversial.xml/NullAssignment"><priority>#</priority></rule> <rule ref="rulesets/controversial.xml/OnlyOneReturn"><priority>#</priority></rule> --> <rule ref="rulesets/controversial.xml/UnusedModifier"><priority>4</priority></rule> <rule ref="rulesets/controversial.xml/AssignmentInOperand"><priority>3</priority></rule> <!-- unused <rule ref="rulesets/controversial.xml/AtLeastOneConstructor"><priority>#</priority></rule> --> <rule ref="rulesets/controversial.xml/DontImportSun"><priority>4</priority></rule> <!-- unused <rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"><priority>#</priority></rule> <rule ref="rulesets/controversial.xml/CallSuperInConstructor"><priority>#</priority></rule> <rule ref="rulesets/controversial.xml/UnnecessaryParentheses"><priority>#</priority></rule> --> <rule ref="rulesets/controversial.xml/DefaultPackage"><priority>3</priority></rule> <!-- unused <rule ref="rulesets/controversial.xml/BooleanInversion"><priority>#</priority></rule> <rule ref="rulesets/controversial.xml/DataflowAnomalyAnalysis"><priority>#</priority></rule> <rule ref="rulesets/controversial.xml/AvoidFinalLocalVariable"><priority>#</priority></rule> <rule ref="rulesets/controversial.xml/AvoidUsingShortType"><priority>#</priority></rule> --> <rule ref="rulesets/controversial.xml/AvoidUsingVolatile"><priority>3</priority></rule> <rule ref="rulesets/controversial.xml/AvoidUsingNativeCode"><priority>4</priority></rule> <rule ref="rulesets/controversial.xml/AvoidAccessibilityAlteration"><priority>4</priority></rule> <!-- Using Findbugs rule <rule ref="rulesets/controversial.xml/DoNotCallGarbageCollectionExplicitly"><priority>4</priority></rule> --> <!-- Coupling Rules --> <rule ref="rulesets/coupling.xml/CouplingBetweenObjects"><priority>5</priority></rule> <rule ref="rulesets/coupling.xml/ExcessiveImports"><priority>5</priority></rule> <rule ref="rulesets/coupling.xml/LooseCoupling"><priority>5</priority></rule> <!-- Design Rules --> <!-- unused <rule ref="rulesets/design.xml/UseSingleton"><priority>#</priority></rule> --> <rule ref="rulesets/design.xml/SimplifyBooleanReturns"><priority>3</priority></rule> <rule ref="rulesets/design.xml/SimplifyBooleanExpressions"><priority>3</priority></rule> <rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"><priority>3</priority></rule> <rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"><priority>5</priority></rule> <rule ref="rulesets/design.xml/AvoidReassigningParameters"><priority>4</priority></rule> <rule ref="rulesets/design.xml/SwitchDensity"><priority>5</priority></rule> <rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"><priority>4</priority></rule> <rule ref="rulesets/design.xml/AccessorClassGeneration"><priority>3</priority></rule> <rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"><priority>3</priority></rule> <rule ref="rulesets/design.xml/CloseResource"><priority>3</priority></rule> <rule ref="rulesets/design.xml/NonStaticInitializer"> <priority>2</priority> <properties> <property name="xpath"> <value> <![CDATA[ //Initializer[ @Static='false' ][ not( ../../../ClassOrInterfaceType[ @Image='Expectations' ][ /ImportDeclaration/Name/@Image='org.jmock.Expectations' ] or ../../../ClassOrInterfaceType[ @Image='Mockery' ][ /ImportDeclaration/Name/@Image='org.jmock.Mockery' ] ) ] ]]> </value> </property> </properties> </rule> <rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"><priority>2</priority></rule> <rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"><priority>2</priority></rule> <rule ref="rulesets/design.xml/OptimizableToArrayCall"><priority>3</priority></rule> <!-- Using Findbugs rule <rule ref="rulesets/design.xml/BadComparison"><priority>#</priority></rule> <rule ref="rulesets/design.xml/EqualsNull"><priority>#</priority></rule> --> <rule ref="rulesets/design.xml/ConfusingTernary"><priority>4</priority></rule> <!-- Using Findbugs rule <rule ref="rulesets/design.xml/InstantiationToGetClass"><priority>3</priority></rule> --> <rule ref="rulesets/design.xml/IdempotentOperations"><priority>2</priority></rule> <!-- Unused <rule ref="rulesets/design.xml/SimpleDateFormatNeedsLocale"><priority>#</priority></rule> --> <rule ref="rulesets/design.xml/ImmutableField"><priority>3</priority></rule> <!-- Unused <rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"><priority>#</priority></rule> --> <!-- Using Findbugs rule <rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"><priority>4</priority></rule> --> <rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"><priority>3</priority></rule> <rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"><priority>2</priority></rule> <rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"> <priority>3</priority> <properties> <property name="xpath"> <value> <![CDATA[ //MethodDeclaration[ @Synchronized='true' ][ ./MethodDeclarator[@Image!='getInstance'] or .[@Static='false'] ] ]]> </value> </property> </properties> </rule> <!-- Using Findbugs rule <rule ref="rulesets/design.xml/MissingBreakInSwitch"><priority>3</priority></rule> <rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"><priority>4</priority></rule> --> <rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"><priority>4</priority></rule> <rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"><priority>4</priority></rule> <rule ref="rulesets/design.xml/SimplifyConditional"><priority>3</priority></rule> <rule ref="rulesets/design.xml/CompareObjectsWithEquals"><priority>2</priority></rule> <rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"><priority>3</priority></rule> <!-- Unused <rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"><priority>#</priority></rule> --> <rule ref="rulesets/design.xml/NonThreadSafeSingleton"><priority>3</priority></rule> <rule ref="rulesets/design.xml/UncommentedEmptyMethod"><priority>3</priority></rule> <rule ref="rulesets/design.xml/UncommentedEmptyConstructor"><priority>3</priority></rule> <!-- Unused <rule ref="rulesets/design.xml/AvoidConstantsInterface"><priority>#</priority></rule> --> <!-- Using Findbugs rule <rule ref="rulesets/design.xml/UnsynchronizedStaticDateFormatter"><priority>2</priority></rule> --> <rule ref="rulesets/design.xml/PreserveStackTrace"><priority>2</priority></rule> <rule ref="rulesets/design.xml/UseCollectionIsEmpty"><priority>3</priority></rule> <rule ref="rulesets/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal"><priority>4</priority></rule> <rule ref="rulesets/design.xml/EmptyMethodInAbstractClassShouldBeAbstract"><priority>4</priority></rule> <rule ref="rulesets/design.xml/SingularField"><priority>4</priority></rule> <!-- Unused <rule ref="rulesets/design.xml/ReturnEmptyArrayRatherThanNull"><priority>#</priority></rule> <rule ref="rulesets/design.xml/AbstractClassWithoutAnyMethod"><priority>#</priority></rule> <rule ref="rulesets/design.xml/TooFewBranchesForASwitchStatement"><priority>#</priority></rule> --> <!-- Finalizer Rules --> <rule ref="rulesets/finalizers.xml/EmptyFinalizer"><priority>2</priority></rule> <rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"><priority>2</priority></rule> <rule ref="rulesets/finalizers.xml/FinalizeOverloaded"><priority>2</priority></rule> <rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"><priority>2</priority></rule> <rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"><priority>2</priority></rule> <rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"><priority>2</priority></rule> <!-- Import Statement Rules --> <rule ref="rulesets/imports.xml/DuplicateImports"><priority>4</priority></rule> <rule ref="rulesets/imports.xml/DontImportJavaLang"><priority>4</priority></rule> <rule ref="rulesets/imports.xml/UnusedImports"><priority>3</priority></rule> <rule ref="rulesets/imports.xml/ImportFromSamePackage"><priority>4</priority></rule> <rule ref="rulesets/imports.xml/TooManyStaticImports" message="Static imports are disallowed"> <priority>2</priority> <properties> <property name="maximumStaticImports" description="Static imports are disallowed"> <value>0</value> </property> </properties> </rule> <!-- J2EE Rules --> <rule ref="rulesets/j2ee.xml/UseProperClassLoader"><priority>2</priority></rule> <rule ref="rulesets/j2ee.xml/MDBAndSessionBeanNamingConvention"><priority>4</priority></rule> <rule ref="rulesets/j2ee.xml/RemoteSessionInterfaceNamingConvention"><priority>4</priority></rule> <rule ref="rulesets/j2ee.xml/LocalInterfaceSessionNamingConvention"><priority>4</priority></rule> <rule ref="rulesets/j2ee.xml/LocalHomeNamingConvention"><priority>4</priority></rule> <rule ref="rulesets/j2ee.xml/RemoteInterfaceNamingConvention"><priority>4</priority></rule> <!-- Using Findbugs rule <rule ref="rulesets/j2ee.xml/DoNotCallSystemExit"><priority>1</priority></rule> --> <rule ref="rulesets/j2ee.xml/StaticEJBFieldShouldBeFinal"><priority>3</priority></rule> <!-- Fix DoNotUseThreads - Runnables are not threads, jUnit tests are ok --> <rule ref="rulesets/j2ee.xml/DoNotUseThreads"> <priority>2</priority> <properties> <property name="xpath"> <value> <![CDATA[ //ClassOrInterfaceType[ @Image = 'Thread' ][ not( ancestor::ClassOrInterfaceDeclaration[ //ClassOrInterfaceType[typeof(@Image, 'junit.framework.TestCase','TestCase')] or //MarkerAnnotation/Name[typeof(@Image, 'org.junit.Test', 'Test')] ] ) and not( ancestor::CastExpression and ancestor::LocalVariableDeclaration[ Type/ReferenceType/ClassOrInterfaceType[@Image = 'Thread'] ] ) ] ]]> </value> </property> </properties> </rule> <!-- JavaBean Rules --> <rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"><priority>2</priority></rule> <!-- Unused <rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"><priority>#</priority></rule> --> <!-- JUnit Rules --> <!-- Using Findbugs rule <rule ref="rulesets/junit.xml/JUnitStaticSuite"><priority>3</priority></rule> --> <rule ref="rulesets/junit.xml/JUnitSpelling"><priority>3</priority></rule> <rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"><priority>3</priority></rule> <rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"><priority>3</priority></rule> <rule ref="rulesets/junit.xml/TestClassWithoutTestCases"><priority>4</priority></rule> <rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"><priority>3</priority></rule> <!-- Fix UseAssertEqualsInsteadOfAssertTrue to allow use of e.g. Arrays.equals(array1, array2) --> <rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"> <priority>3</priority> <properties> <property name="xpath"> <value> <![CDATA[ //PrimaryExpression[ PrimaryPrefix/Name[@Image = 'assertTrue'] ][ PrimarySuffix/Arguments/ArgumentList/Expression/PrimaryExpression/PrimaryPrefix/Name[ ends-with(@Image, '.equals') ][ count(../../PrimarySuffix/Arguments/ArgumentList/Expression) = 1 ] ] [ ancestor::ClassOrInterfaceDeclaration[ //ClassOrInterfaceType[typeof(@Image, 'junit.framework.TestCase','TestCase')] or //MarkerAnnotation/Name[typeof(@Image, 'org.junit.Test', 'Test')] ] ] ]]> </value> </property> </properties> </rule> <!-- Fix UseAssertSameInsteadOfAssertTrue - assertSame can't be used for primitive types --> <rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"> <priority>3</priority> <properties> <property name="xpath"> <value> <![CDATA[ //PrimaryExpression[ PrimaryPrefix/Name[ @Image = 'assertTrue' or @Image = 'assertFalse' ] ][ PrimarySuffix/Arguments/ArgumentList/Expression/EqualityExpression[ count(.//NullLiteral) = 0 and count(.//BooleanLiteral) = 0 and count(.//Literal[matches(@Image, "^[0-9][0-9]*$")]) = 0] ][ ancestor::ClassOrInterfaceDeclaration[ //ClassOrInterfaceType[typeof(@Image, 'junit.framework.TestCase','TestCase')] or //MarkerAnnotation/Name[typeof(@Image, 'org.junit.Test', 'Test')] ] ] ]]> </value> </property> </properties> </rule> <rule ref="rulesets/junit.xml/UseAssertNullInsteadOfAssertTrue"><priority>3</priority></rule> <rule ref="rulesets/junit.xml/SimplifyBooleanAssertion"><priority>3</priority></rule> <!-- Jakarta Commons Logging Rules --> <!-- Unused (not using commons logging) <rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"><priority>#</priority></rule> <rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"><priority>#</priority></rule> --> <!-- Java Logging Rules --> <rule ref="rulesets/logging-java.xml/MoreThanOneLogger"><priority>3</priority></rule> <rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"><priority>3</priority></rule> <rule ref="rulesets/logging-java.xml/SystemPrintln"><priority>2</priority></rule> <rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"><priority>2</priority></rule> <!-- Migration Rules --> <rule ref="rulesets/migrating.xml/ReplaceVectorWithList"><priority>3</priority></rule> <rule ref="rulesets/migrating.xml/ReplaceHashtableWithMap"><priority>3</priority></rule> <rule ref="rulesets/migrating.xml/ReplaceEnumerationWithIterator"><priority>3</priority></rule> <rule ref="rulesets/migrating.xml/AvoidEnumAsIdentifier"><priority>3</priority></rule> <!-- Unused <rule ref="rulesets/migrating.xml/AvoidAssertAsIdentifier"><priority>#</priority></rule> <rule ref="rulesets/migrating.xml/IntegerInstantiation"><priority>#</priority></rule> <rule ref="rulesets/migrating.xml/ByteInstantiation"><priority>#</priority></rule> <rule ref="rulesets/migrating.xml/ShortInstantiation"><priority>#</priority></rule> <rule ref="rulesets/migrating.xml/LongInstantiation"><priority>#</priority></rule> <rule ref="rulesets/migrating.xml/JUnit4TestShouldUseBeforeAnnotation"><priority>#</priority></rule> <rule ref="rulesets/migrating.xml/JUnit4TestShouldUseAfterAnnotation"><priority>#</priority></rule> <rule ref="rulesets/migrating.xml/JUnit4TestShouldUseTestAnnotation"><priority>#</priority></rule> <rule ref="rulesets/migrating.xml/JUnit4SuitesShouldUseSuiteAnnotation"><priority>#</priority></rule> <rule ref="rulesets/migrating.xml/JUnitUseExpected"><priority>#</priority></rule> --> <!-- Naming Rules --> <rule ref="rulesets/naming.xml/ShortVariable"><priority>4</priority></rule> <!-- Unused <rule ref="rulesets/naming.xml/LongVariable"><priority>#</priority></rule> --> <rule ref="rulesets/naming.xml/ShortMethodName"><priority>4</priority></rule> <!-- Unused <rule ref="rulesets/naming.xml/VariableNamingConventions"><priority>#</priority></rule> --> <rule ref="rulesets/naming.xml/MethodNamingConventions"><priority>4</priority></rule> <rule ref="rulesets/naming.xml/ClassNamingConventions"><priority>4</priority></rule> <rule ref="rulesets/naming.xml/AbstractNaming"><priority>4</priority></rule> <rule ref="rulesets/naming.xml/AvoidDollarSigns"><priority>3</priority></rule> <rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"><priority>3</priority></rule> <rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"><priority>3</priority></rule> <rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"><priority>4</priority></rule> <rule ref="rulesets/naming.xml/SuspiciousEqualsMethodName"><priority>3</priority></rule> <rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"><priority>3</priority></rule> <rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"><priority>3</priority></rule> <rule ref="rulesets/naming.xml/NoPackage"><priority>3</priority></rule> <rule ref="rulesets/naming.xml/PackageCase"><priority>4</priority></rule> <rule ref="rulesets/naming.xml/MisleadingVariableName"><priority>4</priority></rule> <rule ref="rulesets/naming.xml/BooleanGetMethodName"><priority>4</priority></rule> <!-- Optimization Rules --> <!-- Unused <rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"><priority>4</priority></rule> --> <rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"><priority>4</priority></rule> <rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"><priority>5</priority></rule> <rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"><priority>4</priority></rule> <rule ref="rulesets/optimizations.xml/SimplifyStartsWith"><priority>4</priority></rule> <rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"><priority>3</priority></rule> <rule ref="rulesets/optimizations.xml/UseArraysAsList"><priority>4</priority></rule> <rule ref="rulesets/optimizations.xml/AvoidArrayLoops"><priority>4</priority></rule> <rule ref="rulesets/optimizations.xml/UnnecessaryWrapperObjectCreation"><priority>3</priority></rule> <rule ref="rulesets/optimizations.xml/AddEmptyString"><priority>3</priority></rule> <!-- Strict Exception Rules --> <rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"><priority>2</priority></rule> <rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"><priority>3</priority></rule> <rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"><priority>2</priority></rule> <rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"><priority>2</priority></rule> <rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"><priority>3</priority></rule> <rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"><priority>3</priority></rule> <rule ref="rulesets/strictexception.xml/AvoidRethrowingException"><priority>3</priority></rule> <rule ref="rulesets/strictexception.xml/DoNotExtendJavaLangError"><priority>3</priority></rule> <rule ref="rulesets/strictexception.xml/DoNotThrowExceptionInFinally"><priority>3</priority></rule> <!-- String and StringBuffer Rules --> <rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"><priority>4</priority></rule> <!-- Using Findbugs rule <rule ref="rulesets/strings.xml/StringInstantiation"><priority>3</priority></rule> <rule ref="rulesets/strings.xml/StringToString"><priority>3</priority></rule> --> <rule ref="rulesets/strings.xml/InefficientStringBuffering"><priority>3</priority></rule> <rule ref="rulesets/strings.xml/UnnecessaryCaseChange"><priority>3</priority></rule> <rule ref="rulesets/strings.xml/UseStringBufferLength"><priority>3</priority></rule> <rule ref="rulesets/strings.xml/AppendCharacterWithChar"><priority>3</priority></rule> <rule ref="rulesets/strings.xml/ConsecutiveLiteralAppends"><priority>4</priority></rule> <rule ref="rulesets/strings.xml/UseIndexOfChar"><priority>4</priority></rule> <rule ref="rulesets/strings.xml/InefficientEmptyStringCheck"><priority>3</priority></rule> <rule ref="rulesets/strings.xml/InsufficientStringBufferDeclaration"><priority>4</priority></rule> <rule ref="rulesets/strings.xml/UselessStringValueOf"><priority>3</priority></rule> <rule ref="rulesets/strings.xml/StringBufferInstantiationWithChar"><priority>3</priority></rule> <!-- Using Findbugs rule <rule ref="rulesets/strings.xml/UseEqualsToCompareStrings"><priority>2</priority></rule> --> <rule ref="rulesets/strings.xml/AvoidStringBufferField"><priority>3</priority></rule> <!-- Security Code Guidelines --> <rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"><priority>4</priority></rule> <rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"><priority>4</priority></rule> <!-- Unused Code Rules --> <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"><priority>3</priority></rule> <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"><priority>3</priority></rule> <!-- Using Findbugs rule <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"><priority>3</priority></rule> --> <rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"><priority>4</priority></rule> </ruleset>