Changeset 19113 in josm for trunk/tools/pmd
- Timestamp:
- 2024-06-18T22:29:22+02:00 (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/pmd/josm-ruleset.xml
r18918 r19113 6 6 7 7 <description>JOSM PMD ruleset</description> 8 <!-- Generated files --> 9 <exclude-pattern>.*/org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/.*</exclude-pattern> 8 10 9 11 <rule ref="category/java/bestpractices.xml"> 10 <exclude name="AccessorClassGeneration"/>11 <exclude name="AccessorMethodGeneration"/>12 12 <exclude name="ArrayIsStoredDirectly"/> 13 13 <exclude name="AvoidPrintStackTrace"/> … … 15 15 <exclude name="AvoidReassigningParameters"/> 16 16 <exclude name="AvoidStringBufferField"/> 17 <exclude name="AvoidUsingHardCodedIP"/>18 17 <exclude name="ConstantsInInterface"/> 19 <exclude name="ForLoopCanBeForeach"/>20 <exclude name="ForLoopVariableCount"/>21 18 <exclude name="GuardLogStatement"/> 22 <exclude name="JUnit4TestShouldUseAfterAnnotation"/> 23 <exclude name="JUnit4TestShouldUseTestAnnotation"/> 19 <exclude name="JUnit4TestShouldUseTestAnnotation" reason="False positive in src/org/openstreetmap/josm/data/validation/Test.java"/> 24 20 <exclude name="LiteralsFirstInComparisons" reason="Introduced in 6.24, some positives in source code at this time. Replaces PositionLiteralsFirstInComparisons."/> 25 21 <exclude name="LooseCoupling"/> 26 22 <exclude name="MethodReturnsInternalArray"/> 27 23 <exclude name="OneDeclarationPerLine"/> 28 <exclude name="PreserveStackTrace"/>29 24 <exclude name="ReplaceHashtableWithMap"/> 30 25 <exclude name="SwitchStmtsShouldHaveDefault"/> 31 26 <exclude name="SystemPrintln"/> 32 27 <exclude name="UnusedAssignment" reason="Introduced in 6.26, some number of positives in source code at this time"/> 33 <exclude name="UnusedFormalParameter"/>34 28 <exclude name="UnusedPrivateMethod" reason="Broken since PMD 6.33, see https://github.com/pmd/pmd/issues/3468"/> 29 <exclude name="UnusedPrivateField" reason="Broken in 7.2.x"/> 35 30 <exclude name="UseVarargs"/> 36 31 </rule> 37 <rule ref="category/java/bestpractices.xml/ PreserveStackTrace">32 <rule ref="category/java/bestpractices.xml/ForLoopCanBeForeach"> 38 33 <properties> 39 <property name="violationSuppressXPath" value="//PrimaryExpression/PrimaryPrefix/Name[@Image='BugReport.intercept']"/> 34 <!-- The list is expanded during iteration --> 35 <property name="violationSuppressXPath" value="//ClassDeclaration[@SimpleName='PurgeCommand']/ClassBody/MethodDeclaration[@Name='build']/Block/IfStatement/Block/ForStatement/InfixExpression/MethodCall/VariableAccess[@Name='relLst']"/> 40 36 </properties> 41 37 </rule> 42 <rule ref="category/java/bestpractices.xml/ UnusedFormalParameter">38 <rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"> 43 39 <properties> 44 Annotation[MarkerAnnotation/Name/@SimpleName='Deprecated']/..[MethodDeclaration|ConstructorDeclaration]"/>40 <property name="violationSuppressXPath" value="//ClassDeclaration[@SimpleName='DefaultProxySelector' or @SimpleName='RemoteControl']"/> 45 41 </properties> 46 42 </rule> 47 43 <rule ref="category/java/codestyle.xml"> 48 <exclude name="AbstractNaming"/>49 44 <exclude name="AtLeastOneConstructor"/> 50 <exclude name="AvoidFinalLocalVariable"/>51 <exclude name="AvoidPrefixingMethodParameters"/>52 45 <exclude name="BooleanGetMethodName"/> 53 46 <exclude name="CallSuperInConstructor"/> … … 56 49 <exclude name="ConfusingTernary"/> 57 50 <exclude name="ControlStatementBraces"/> 58 <exclude name="DefaultPackage"/>59 51 <!-- EmptyControlStatement is not configurable, so the behavior of the old excludes of EmptyIfStmt/EmptyWhileStmt (errorprone.xml) while getting new functionality cannot be done --> 60 52 <exclude name="EmptyControlStatement"/> … … 62 54 <exclude name="FieldDeclarationsShouldBeAtStartOfClass"/> 63 55 <exclude name="FieldNamingConventions"/> 64 <exclude name="ForLoopsMustUseBraces"/>65 <exclude name="IfElseStmtsMustUseBraces"/>66 <exclude name="IfStmtsMustUseBraces"/>67 56 <exclude name="LinguisticNaming"/> 68 57 <exclude name="LocalVariableCouldBeFinal"/> … … 81 70 <exclude name="UseUnderscoresInNumericLiterals"/> 82 71 <exclude name="UselessParentheses"/> 83 <exclude name="VariableNamingConventions"/> 84 <exclude name="WhileLoopsMustUseBraces"/> 72 <exclude name="UnnecessaryFullyQualifiedName" reason="7.x increased sensitivity (250 new issues), and it now warns on qualified names inside a class, e.g. ClassName.STATIC_VARIABLE. Should probably be fixed in our source code."/> 85 73 </rule> 86 74 <rule ref="category/java/codestyle.xml/ShortMethodName"> 87 75 <properties> 88 <property name="violationSuppressXPath" value="//MethodDeclaration[@Name='at' or @Name='ht' or @Name='of' or @Name='ok' or @Name='tr'] 89 | //MethodDeclaration/../../Annotation/MarkerAnnotation/Name[@Image='Deprecated'] 90 | //MethodDeclaration/../../../..[@Image='LambertConformalConic']"/> 76 <property name="violationSuppressXPath" value="//MethodDeclaration[@Name='at' or @Name='ht' or @Name='of' or @Name='ok' or @Name='tr']"/> 91 77 </properties> 92 78 </rule> 93 79 <rule ref="category/java/codestyle.xml/MethodNamingConventions"> 94 80 <properties> 95 MethodDeclaration/../../..[@SimpleName='Functions' or @SimpleName='PseudoClasses' or @SimpleName='Role' or @SimpleName='TaggingPreset' or @SimpleName='RegionSpecific']"/>81 <property name="violationSuppressXPath" value="//ClassDeclaration[@SimpleName='Functions' or @SimpleName='PseudoClasses' or @SimpleName='Role' or @SimpleName='TaggingPreset' or @SimpleName='RegionSpecific']"/> 96 82 </properties> 97 83 </rule> … … 99 85 <properties> 100 86 <property name="enumConstantPattern" value="[A-Za-z][A-Za-z_0-9]*"/> 101 <property name="violationSuppressXPath" value="//FieldDeclaration[@ Public='true']102 | //FieldDeclaration/ ../Annotation/MarkerAnnotation/Name[@Image='pref']103 | //FieldDeclaration/ Type/ReferenceType/ClassOrInterfaceType[@Image!='Boolean' and104 @Image!='Byte' and105 @Image!='Character' and106 @Image!='Class' and107 @Image!='Double' and108 @Image!='Enum' and109 @Image!='Float' and110 @Image!='Integer' and111 @Image!='Long' and112 @Image!='Number' and113 @Image!='Short' and114 @Image!='String' ]"/>87 <property name="violationSuppressXPath" value="//FieldDeclaration[@Visibility='public'] 88 | //FieldDeclaration/ModifierList/Annotation[@SimpleName='StructEntry'] 89 | //FieldDeclaration/ClassType[@SimpleName!='Boolean' and 90 @SimpleName!='Byte' and 91 @SimpleName!='Character' and 92 @SimpleName!='Class' and 93 @SimpleName!='Double' and 94 @SimpleName!='Enum' and 95 @SimpleName!='Float' and 96 @SimpleName!='Integer' and 97 @SimpleName!='Long' and 98 @SimpleName!='Number' and 99 @SimpleName!='Short' and 100 @SimpleName!='String' ]"/> 115 101 </properties> 116 102 </rule> … … 124 110 <exclude name="AvoidDeeplyNestedIfStmts"/> 125 111 <exclude name="AvoidRethrowingException"/> 112 <exclude name="AvoidUncheckedExceptionsInSignatures" reason="We disagree with the reasoning for making this an issue; a strength of Java is verbosity, and warning users about adding `@throws <? extends RuntimeException>` is probably a bad long-term idea."/> 126 113 <exclude name="CognitiveComplexity" reason="Introduced in 6.35, some number of positives in source code at this time"/> 127 114 <exclude name="CollapsibleIfStatements"/> … … 142 129 <exclude name="SignatureDeclareThrowsException"/> 143 130 <exclude name="SimplifiedTernary"/> 131 <exclude name="SimplifyBooleanReturns" reason="Increased sensitivity in 7.x; should be fixed in our source code." /> 144 132 <exclude name="SimplifyConditional"/> 145 133 <exclude name="SingularField"/> … … 153 141 <rule ref="category/java/design.xml/SignatureDeclareThrowsException"> 154 142 <properties> 155 <property name="violationSuppressXPath" value="//MethodDeclaration/ ../Annotation/MarkerAnnotation/Name[@Image='Override']"/>143 <property name="violationSuppressXPath" value="//MethodDeclaration/ModifierList/Annotation[@SimpleName='Override']"/> 156 144 <property name="IgnoreJUnitCompletely" value="true"/> 157 145 </properties> … … 167 155 <exclude name="AvoidInstanceofChecksInCatchClause"/> 168 156 <exclude name="AvoidLiteralsInIfCondition"/> 169 <exclude name="CloneThrowsCloneNotSupportedException"/>170 <!-- <exclude name="CloseResource"/> -->171 157 <exclude name="CompareObjectsWithEquals"/> 158 <exclude name="ConfusingArgumentToVarargsMethod" reason="Introduced in 7.1.0; there are false positives in source code at this time."/> 172 159 <exclude name="ConstructorCallsOverridableMethod"/> 173 <exclude name="DataflowAnomalyAnalysis"/>174 160 <exclude name="DoNotTerminateVM"/> 175 161 <exclude name="DontImportSun"/> … … 180 166 <exclude name="NonStaticInitializer"/> 181 167 <exclude name="NullAssignment"/> 182 <exclude name="ReturnEmptyArrayRatherThanNull"/>183 168 <exclude name="ReturnEmptyCollectionRatherThanNull" reason="Introduced in 6.37, there are positives in source code at this time"/> 184 169 <exclude name="SimpleDateFormatNeedsLocale"/> … … 190 175 <rule ref="category/java/errorprone.xml/AvoidAccessibilityAlteration"> 191 176 <properties> 192 <property name="violationSuppressXPath" value="// MethodDeclaration/../../..[@SimpleName='ReflectionUtils']"/>177 <property name="violationSuppressXPath" value="//ClassDeclaration[@SimpleName='ReflectionUtils']"/> 193 178 </properties> 194 179 </rule> 195 180 <rule ref="category/java/performance.xml"> 196 181 <exclude name="AvoidInstantiatingObjectsInLoops"/> 197 <exclude name="AvoidUsingShortType"/>198 182 <exclude name="ConsecutiveLiteralAppends"/> 199 183 <exclude name="InefficientEmptyStringCheck"/> 200 <exclude name="SimplifyStartsWith"/>201 184 <exclude name="InsufficientStringBufferDeclaration" reason="PMD 6.40 has a bug where it doesn't properly count appended strings in if statements."/> 202 185 <exclude name="TooFewBranchesForASwitchStatement"/>
Note:
See TracChangeset
for help on using the changeset viewer.