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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
|
<?xml version="1.0"?>
<ruleset name="JOSM ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>JOSM PMD ruleset</description>
<rule ref="category/java/bestpractices.xml">
<exclude name="AccessorClassGeneration"/>
<exclude name="AccessorMethodGeneration"/>
<exclude name="ArrayIsStoredDirectly"/>
<exclude name="AvoidPrintStackTrace"/>
<exclude name="AvoidReassigningLoopVariables"/>
<exclude name="AvoidReassigningParameters"/>
<exclude name="AvoidStringBufferField"/>
<exclude name="AvoidUsingHardCodedIP"/>
<exclude name="ConstantsInInterface"/>
<exclude name="ForLoopCanBeForeach"/>
<exclude name="ForLoopVariableCount"/>
<exclude name="GuardLogStatement"/>
<exclude name="JUnit4TestShouldUseAfterAnnotation"/>
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
<exclude name="LiteralsFirstInComparisons" reason="Introduced in 6.24, some positives in source code at this time. Replaces PositionLiteralsFirstInComparisons."/>
<exclude name="LooseCoupling"/>
<exclude name="MethodReturnsInternalArray"/>
<exclude name="OneDeclarationPerLine"/>
<exclude name="PreserveStackTrace"/>
<exclude name="ReplaceHashtableWithMap"/>
<exclude name="SwitchStmtsShouldHaveDefault"/>
<exclude name="SystemPrintln"/>
<exclude name="UnusedAssignment" reason="Introduced in 6.26, some number of positives in source code at this time"/>
<exclude name="UnusedFormalParameter"/>
<exclude name="UnusedPrivateMethod" reason="Broken since PMD 6.33, see https://github.com/pmd/pmd/issues/3468"/>
<exclude name="UseVarargs"/>
</rule>
<rule ref="category/java/bestpractices.xml/PreserveStackTrace">
<properties>
<property name="violationSuppressXPath" value="//PrimaryExpression/PrimaryPrefix/Name[@Image='BugReport.intercept']"/>
</properties>
</rule>
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter">
<properties>
<property name="violationSuppressXPath" value="//Annotation[MarkerAnnotation/Name/@SimpleName='Deprecated']/..[MethodDeclaration|ConstructorDeclaration]"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml">
<exclude name="AbstractNaming"/>
<exclude name="AtLeastOneConstructor"/>
<exclude name="AvoidFinalLocalVariable"/>
<exclude name="AvoidPrefixingMethodParameters"/>
<exclude name="BooleanGetMethodName"/>
<exclude name="CallSuperInConstructor"/>
<exclude name="ClassNamingConventions"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="ConfusingTernary"/>
<exclude name="ControlStatementBraces"/>
<exclude name="DefaultPackage"/>
<!-- EmptyControlStatement is not configurable, so the behavior of the old excludes of EmptyIfStmt/EmptyWhileStmt (errorprone.xml) while getting new functionality cannot be done -->
<exclude name="EmptyControlStatement"/>
<exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
<exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
<exclude name="FieldNamingConventions"/>
<exclude name="ForLoopsMustUseBraces"/>
<exclude name="IfElseStmtsMustUseBraces"/>
<exclude name="IfStmtsMustUseBraces"/>
<exclude name="LinguisticNaming"/>
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="LongVariable"/>
<exclude name="MethodArgumentCouldBeFinal"/>
<exclude name="MethodNamingConventions"/>
<exclude name="NoPackage"/>
<exclude name="OnlyOneReturn"/>
<exclude name="PrematureDeclaration"/>
<exclude name="ShortClassName"/>
<exclude name="ShortMethodName"/>
<exclude name="ShortVariable"/>
<exclude name="TooManyStaticImports"/>
<exclude name="UnnecessaryCast" reason="Introduced in 6.24, some positives in source code at this time"/>
<exclude name="UnnecessaryConstructor"/>
<exclude name="UseUnderscoresInNumericLiterals"/>
<exclude name="UselessParentheses"/>
<exclude name="VariableNamingConventions"/>
<exclude name="WhileLoopsMustUseBraces"/>
</rule>
<rule ref="category/java/codestyle.xml/ShortMethodName">
<properties>
<property name="violationSuppressXPath" value="//MethodDeclaration[@Name='at' or @Name='ht' or @Name='of' or @Name='ok' or @Name='tr']
| //MethodDeclaration/../../Annotation/MarkerAnnotation/Name[@Image='Deprecated']
| //MethodDeclaration/../../../..[@Image='LambertConformalConic']"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml/MethodNamingConventions">
<properties>
<property name="violationSuppressXPath" value="//MethodDeclaration/../../..[@SimpleName='Functions' or @SimpleName='PseudoClasses' or @SimpleName='Role' or @SimpleName='TaggingPreset']"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml/FieldNamingConventions">
<properties>
<property name="enumConstantPattern" value="[A-Za-z][A-Za-z_0-9]*"/>
<property name="violationSuppressXPath" value="//FieldDeclaration[@Public='true']
| //FieldDeclaration/../Annotation/MarkerAnnotation/Name[@Image='pref']
| //FieldDeclaration/Type/ReferenceType/ClassOrInterfaceType[@Image!='Boolean' and
@Image!='Byte' and
@Image!='Character' and
@Image!='Class' and
@Image!='Double' and
@Image!='Enum' and
@Image!='Float' and
@Image!='Integer' and
@Image!='Long' and
@Image!='Number' and
@Image!='Short' and
@Image!='String' ]"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml/LongVariable">
<properties>
<property name="minimum" value="44"/>
</properties>
</rule>
<rule ref="category/java/design.xml">
<exclude name="AvoidCatchingGenericException"/>
<exclude name="AvoidDeeplyNestedIfStmts"/>
<exclude name="AvoidRethrowingException"/>
<exclude name="CognitiveComplexity" reason="Introduced in 6.35, some number of positives in source code at this time"/>
<exclude name="CollapsibleIfStatements"/>
<exclude name="CouplingBetweenObjects"/>
<exclude name="CyclomaticComplexity"/>
<exclude name="DataClass"/>
<exclude name="ExceptionAsFlowControl"/>
<exclude name="ExcessiveImports"/>
<exclude name="ExcessiveParameterList"/>
<exclude name="ExcessivePublicCount"/>
<exclude name="GodClass"/>
<exclude name="ImmutableField"/>
<exclude name="LawOfDemeter"/>
<exclude name="LoosePackageCoupling"/>
<exclude name="MutableStaticState" reason="Introduced in 6.35, some number of positives in source code at this time"/>
<exclude name="NcssCount"/>
<exclude name="NPathComplexity"/>
<exclude name="SignatureDeclareThrowsException"/>
<exclude name="SimplifiedTernary"/>
<exclude name="SimplifyConditional"/>
<exclude name="SingularField"/>
<exclude name="SwitchDensity"/>
<exclude name="TooManyFields"/>
<exclude name="TooManyMethods"/>
<exclude name="UseObjectForClearerAPI"/>
<exclude name="UselessOverridingMethod"/>
<exclude name="UseUtilityClass"/>
</rule>
<rule ref="category/java/design.xml/SignatureDeclareThrowsException">
<properties>
<property name="violationSuppressXPath" value="//MethodDeclaration/../Annotation/MarkerAnnotation/Name[@Image='Override']"/>
<property name="IgnoreJUnitCompletely" value="true"/>
</properties>
</rule>
<rule ref="category/java/errorprone.xml">
<exclude name="AssignmentInOperand"/>
<exclude name="AssignmentToNonFinalStatic"/>
<exclude name="AvoidBranchingStatementAsLastInLoop"/>
<exclude name="AvoidCatchingNPE"/>
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AvoidInstanceofChecksInCatchClause"/>
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="CloneThrowsCloneNotSupportedException"/>
<!-- <exclude name="CloseResource"/> -->
<exclude name="CompareObjectsWithEquals"/>
<exclude name="ConstructorCallsOverridableMethod"/>
<exclude name="DataflowAnomalyAnalysis"/>
<exclude name="DoNotTerminateVM"/>
<exclude name="DontImportSun"/>
<exclude name="ImplicitSwitchFallThrough"/>
<exclude name="MissingSerialVersionUID"/>
<exclude name="MissingStaticMethodInNonInstantiatableClass"/>
<exclude name="NonSerializableClass"/>
<exclude name="NonStaticInitializer"/>
<exclude name="NullAssignment"/>
<exclude name="ReturnEmptyArrayRatherThanNull"/>
<exclude name="ReturnEmptyCollectionRatherThanNull" reason="Introduced in 6.37, there are positives in source code at this time"/>
<exclude name="SimpleDateFormatNeedsLocale"/>
<exclude name="SingleMethodSingleton"/>
<exclude name="SingletonClassReturningNewInstance"/>
<exclude name="TestClassWithoutTestCases"/>
<exclude name="UseProperClassLoader"/>
</rule>
<rule ref="category/java/errorprone.xml/AvoidAccessibilityAlteration">
<properties>
<property name="violationSuppressXPath" value="//MethodDeclaration/../../..[@SimpleName='ReflectionUtils']"/>
</properties>
</rule>
<rule ref="category/java/performance.xml">
<exclude name="AvoidInstantiatingObjectsInLoops"/>
<exclude name="AvoidUsingShortType"/>
<exclude name="ConsecutiveLiteralAppends"/>
<exclude name="InefficientEmptyStringCheck"/>
<exclude name="SimplifyStartsWith"/>
<exclude name="InsufficientStringBufferDeclaration" reason="PMD 6.40 has a bug where it doesn't properly count appended strings in if statements."/>
<exclude name="TooFewBranchesForASwitchStatement"/>
<exclude name="UseArrayListInsteadOfVector"/>
<exclude name="UselessStringValueOf"/>
<exclude name="UseStringBufferForStringAppends"/>
</rule>
</ruleset>
|