source: josm/trunk/tools/pmd/josm-ruleset.xml@ 18337

Last change on this file since 18337 was 18332, checked in by Don-vip, 3 years ago

see #21596 - Update dependencies in ivy.xml and tools/ivy.xml (patch by taylor.smock)

File size: 10.6 KB
RevLine 
[11713]1<?xml version="1.0"?>
2<ruleset name="JOSM ruleset"
3 xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5 xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
[18332]6
[11713]7 <description>JOSM PMD ruleset</description>
[18332]8
[13202]9 <rule ref="category/java/bestpractices.xml">
10 <exclude name="AccessorClassGeneration"/>
11 <exclude name="AccessorMethodGeneration"/>
12 <exclude name="ArrayIsStoredDirectly"/>
13 <exclude name="AvoidPrintStackTrace"/>
[15588]14 <exclude name="AvoidReassigningLoopVariables"/>
[13202]15 <exclude name="AvoidReassigningParameters"/>
16 <exclude name="AvoidStringBufferField"/>
17 <exclude name="AvoidUsingHardCodedIP"/>
18 <exclude name="ConstantsInInterface"/>
19 <exclude name="ForLoopCanBeForeach"/>
[15588]20 <exclude name="ForLoopVariableCount"/>
[13202]21 <exclude name="GuardLogStatement"/>
22 <exclude name="JUnit4TestShouldUseAfterAnnotation"/>
23 <exclude name="JUnit4TestShouldUseTestAnnotation"/>
[18332]24 <exclude name="LiteralsFirstInComparisons" reason="Introduced in 6.24, some positives in source code at this time. Replaces PositionLiteralsFirstInComparisons."/>
[13202]25 <exclude name="LooseCoupling"/>
26 <exclude name="MethodReturnsInternalArray"/>
27 <exclude name="OneDeclarationPerLine"/>
28 <exclude name="PreserveStackTrace"/>
29 <exclude name="ReplaceHashtableWithMap"/>
30 <exclude name="SwitchStmtsShouldHaveDefault"/>
31 <exclude name="SystemPrintln"/>
[18332]32 <exclude name="UnusedAssignment" reason="Introduced in 6.26, some number of positives in source code at this time"/>
[13202]33 <exclude name="UnusedFormalParameter"/>
[18332]34 <exclude name="UnusedPrivateMethod" reason="Broken since PMD 6.33, see https://github.com/pmd/pmd/issues/3468"/>
[13202]35 <exclude name="UseVarargs"/>
[12539]36 </rule>
[13207]37 <rule ref="category/java/bestpractices.xml/PreserveStackTrace">
38 <properties>
39 <property name="violationSuppressXPath" value="//PrimaryExpression/PrimaryPrefix/Name[@Image='BugReport.intercept']"/>
40 </properties>
41 </rule>
[13202]42 <rule ref="category/java/bestpractices.xml/UnusedFormalParameter">
[12539]43 <properties>
[18332]44 <property name="violationSuppressXPath" value="//Annotation[MarkerAnnotation/Name/@SimpleName='Deprecated']/..[MethodDeclaration|ConstructorDeclaration]"/>
[13202]45 </properties>
46 </rule>
47 <rule ref="category/java/codestyle.xml">
48 <exclude name="AbstractNaming"/>
49 <exclude name="AtLeastOneConstructor"/>
50 <exclude name="AvoidFinalLocalVariable"/>
51 <exclude name="AvoidPrefixingMethodParameters"/>
52 <exclude name="BooleanGetMethodName"/>
53 <exclude name="CallSuperInConstructor"/>
[13719]54 <exclude name="ClassNamingConventions"/>
[13202]55 <exclude name="CommentDefaultAccessModifier"/>
56 <exclude name="ConfusingTernary"/>
[13595]57 <exclude name="ControlStatementBraces"/>
[13202]58 <exclude name="DefaultPackage"/>
59 <exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
60 <exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
[14604]61 <exclude name="FieldNamingConventions"/>
[13202]62 <exclude name="ForLoopsMustUseBraces"/>
63 <exclude name="IfElseStmtsMustUseBraces"/>
64 <exclude name="IfStmtsMustUseBraces"/>
[14604]65 <exclude name="LinguisticNaming"/>
[13202]66 <exclude name="LocalVariableCouldBeFinal"/>
67 <exclude name="LongVariable"/>
68 <exclude name="MethodArgumentCouldBeFinal"/>
69 <exclude name="MethodNamingConventions"/>
[14638]70 <exclude name="NoPackage"/>
[13202]71 <exclude name="OnlyOneReturn"/>
72 <exclude name="PrematureDeclaration"/>
73 <exclude name="ShortClassName"/>
74 <exclude name="ShortMethodName"/>
75 <exclude name="ShortVariable"/>
76 <exclude name="TooManyStaticImports"/>
[18332]77 <exclude name="UnnecessaryCast" reason="Introduced in 6.24, some positives in source code at this time"/>
[13202]78 <exclude name="UnnecessaryConstructor"/>
[18332]79 <exclude name="UseUnderscoresInNumericLiterals"/>
[13202]80 <exclude name="UselessParentheses"/>
81 <exclude name="VariableNamingConventions"/>
82 <exclude name="WhileLoopsMustUseBraces"/>
83 </rule>
84 <rule ref="category/java/codestyle.xml/ShortMethodName">
85 <properties>
[18332]86 <property name="violationSuppressXPath" value="//MethodDeclaration[@Name='at' or @Name='ht' or @Name='of' or @Name='ok' or @Name='tr']
87 | //MethodDeclaration/../../Annotation/MarkerAnnotation/Name[@Image='Deprecated']
88 | //MethodDeclaration/../../../..[@Image='LambertConformalConic']"/>
[12539]89 </properties>
90 </rule>
[13202]91 <rule ref="category/java/codestyle.xml/MethodNamingConventions">
[12539]92 <properties>
[18332]93 <property name="violationSuppressXPath" value="//MethodDeclaration/../../..[@SimpleName='Functions' or @SimpleName='PseudoClasses' or @SimpleName='Role' or @SimpleName='TaggingPreset']"/>
[12539]94 </properties>
95 </rule>
[14604]96 <rule ref="category/java/codestyle.xml/FieldNamingConventions">
[12539]97 <properties>
[14604]98 <property name="enumConstantPattern" value="[A-Za-z][A-Za-z_0-9]*"/>
[12542]99 <property name="violationSuppressXPath" value="//FieldDeclaration[@Public='true']
[13202]100 | //FieldDeclaration/../Annotation/MarkerAnnotation/Name[@Image='pref']
[18332]101 | //FieldDeclaration/Type/ReferenceType/ClassOrInterfaceType[@Image!='Boolean' and
102 @Image!='Byte' and
103 @Image!='Character' and
104 @Image!='Class' and
105 @Image!='Double' and
106 @Image!='Enum' and
107 @Image!='Float' and
[13202]108 @Image!='Integer' and
109 @Image!='Long' and
110 @Image!='Number' and
[18332]111 @Image!='Short' and
[13202]112 @Image!='String' ]"/>
[12539]113 </properties>
114 </rule>
[13202]115 <rule ref="category/java/codestyle.xml/LongVariable">
[12539]116 <properties>
117 <property name="minimum" value="44"/>
118 </properties>
119 </rule>
[13202]120 <rule ref="category/java/design.xml">
121 <exclude name="AvoidCatchingGenericException"/>
122 <exclude name="AvoidDeeplyNestedIfStmts"/>
123 <exclude name="AvoidRethrowingException"/>
[18332]124 <exclude name="CognitiveComplexity" reason="Introduced in 6.35, some number of positives in source code at this time"/>
[13202]125 <exclude name="CollapsibleIfStatements"/>
126 <exclude name="CouplingBetweenObjects"/>
127 <exclude name="CyclomaticComplexity"/>
128 <exclude name="DataClass"/>
129 <exclude name="ExceptionAsFlowControl"/>
130 <exclude name="ExcessiveClassLength"/>
131 <exclude name="ExcessiveImports"/>
132 <exclude name="ExcessiveMethodLength"/>
133 <exclude name="ExcessiveParameterList"/>
134 <exclude name="ExcessivePublicCount"/>
135 <exclude name="GodClass"/>
136 <exclude name="ImmutableField"/>
137 <exclude name="LawOfDemeter"/>
138 <exclude name="LoosePackageCoupling"/>
[18332]139 <exclude name="MutableStaticState" reason="Introduced in 6.35, some number of positives in source code at this time"/>
[13202]140 <exclude name="NcssCount"/>
141 <exclude name="NPathComplexity"/>
142 <exclude name="SignatureDeclareThrowsException"/>
143 <exclude name="SimplifiedTernary"/>
144 <exclude name="SimplifyConditional"/>
145 <exclude name="SingularField"/>
146 <exclude name="SwitchDensity"/>
147 <exclude name="TooManyFields"/>
148 <exclude name="TooManyMethods"/>
149 <exclude name="UseObjectForClearerAPI"/>
150 <exclude name="UselessOverridingMethod"/>
151 <exclude name="UseUtilityClass"/>
[11930]152 </rule>
[13202]153 <rule ref="category/java/design.xml/SignatureDeclareThrowsException">
[11739]154 <properties>
155 <property name="violationSuppressXPath" value="//MethodDeclaration/../Annotation/MarkerAnnotation/Name[@Image='Override']"/>
156 <property name="IgnoreJUnitCompletely" value="true"/>
157 </properties>
158 </rule>
[13202]159 <rule ref="category/java/errorprone.xml">
160 <exclude name="AssignmentInOperand"/>
161 <exclude name="AssignmentToNonFinalStatic"/>
162 <exclude name="AvoidBranchingStatementAsLastInLoop"/>
163 <exclude name="AvoidCatchingNPE"/>
164 <exclude name="AvoidDuplicateLiterals"/>
165 <exclude name="AvoidFieldNameMatchingMethodName"/>
166 <exclude name="AvoidFieldNameMatchingTypeName"/>
167 <exclude name="AvoidInstanceofChecksInCatchClause"/>
168 <exclude name="AvoidLiteralsInIfCondition"/>
169 <exclude name="BeanMembersShouldSerialize"/>
[14209]170 <exclude name="CloneThrowsCloneNotSupportedException"/>
[15588]171 <!-- <exclude name="CloseResource"/> -->
[13202]172 <exclude name="CompareObjectsWithEquals"/>
173 <exclude name="ConstructorCallsOverridableMethod"/>
174 <exclude name="DataflowAnomalyAnalysis"/>
[18332]175 <exclude name="DoNotTerminateVM"/>
[13202]176 <exclude name="DontImportSun"/>
177 <exclude name="EmptyIfStmt"/>
178 <exclude name="EmptyWhileStmt"/>
[18332]179 <exclude name="ImplicitSwitchFallThrough"/>
[13202]180 <exclude name="MissingSerialVersionUID"/>
181 <exclude name="MissingStaticMethodInNonInstantiatableClass"/>
182 <exclude name="NonStaticInitializer"/>
183 <exclude name="NullAssignment"/>
184 <exclude name="ReturnEmptyArrayRatherThanNull"/>
[18332]185 <exclude name="ReturnEmptyCollectionRatherThanNull" reason="Introduced in 6.37, there are positives in source code at this time"/>
[13202]186 <exclude name="SimpleDateFormatNeedsLocale"/>
187 <exclude name="SingleMethodSingleton"/>
188 <exclude name="SingletonClassReturningNewInstance"/>
189 <exclude name="TestClassWithoutTestCases"/>
190 <exclude name="UseProperClassLoader"/>
[11739]191 </rule>
[18332]192 <rule ref="category/java/errorprone.xml/AvoidAccessibilityAlteration">
193 <properties>
194 <property name="violationSuppressXPath" value="//MethodDeclaration/../../..[@SimpleName='ReflectionUtils']"/>
195 </properties>
196 </rule>
[13202]197 <rule ref="category/java/performance.xml">
198 <exclude name="AvoidInstantiatingObjectsInLoops"/>
199 <exclude name="AvoidUsingShortType"/>
200 <exclude name="ConsecutiveLiteralAppends"/>
201 <exclude name="InefficientEmptyStringCheck"/>
202 <exclude name="SimplifyStartsWith"/>
[18332]203 <exclude name="InsufficientStringBufferDeclaration" reason="PMD 6.40 has a bug where it doesn't properly count appended strings in if statements."/>
[13202]204 <exclude name="TooFewBranchesForASwitchStatement"/>
205 <exclude name="UseArrayListInsteadOfVector"/>
206 <exclude name="UselessStringValueOf"/>
207 <exclude name="UseStringBufferForStringAppends"/>
[11713]208 </rule>
209
[13220]210</ruleset>
Note: See TracBrowser for help on using the repository browser.