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

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

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

File size: 10.6 KB
Line 
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">
6
7 <description>JOSM PMD ruleset</description>
8
9 <rule ref="category/java/bestpractices.xml">
10 <exclude name="AccessorClassGeneration"/>
11 <exclude name="AccessorMethodGeneration"/>
12 <exclude name="ArrayIsStoredDirectly"/>
13 <exclude name="AvoidPrintStackTrace"/>
14 <exclude name="AvoidReassigningLoopVariables"/>
15 <exclude name="AvoidReassigningParameters"/>
16 <exclude name="AvoidStringBufferField"/>
17 <exclude name="AvoidUsingHardCodedIP"/>
18 <exclude name="ConstantsInInterface"/>
19 <exclude name="ForLoopCanBeForeach"/>
20 <exclude name="ForLoopVariableCount"/>
21 <exclude name="GuardLogStatement"/>
22 <exclude name="JUnit4TestShouldUseAfterAnnotation"/>
23 <exclude name="JUnit4TestShouldUseTestAnnotation"/>
24 <exclude name="LiteralsFirstInComparisons" reason="Introduced in 6.24, some positives in source code at this time. Replaces PositionLiteralsFirstInComparisons."/>
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"/>
32 <exclude name="UnusedAssignment" reason="Introduced in 6.26, some number of positives in source code at this time"/>
33 <exclude name="UnusedFormalParameter"/>
34 <exclude name="UnusedPrivateMethod" reason="Broken since PMD 6.33, see https://github.com/pmd/pmd/issues/3468"/>
35 <exclude name="UseVarargs"/>
36 </rule>
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>
42 <rule ref="category/java/bestpractices.xml/UnusedFormalParameter">
43 <properties>
44 <property name="violationSuppressXPath" value="//Annotation[MarkerAnnotation/Name/@SimpleName='Deprecated']/..[MethodDeclaration|ConstructorDeclaration]"/>
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"/>
54 <exclude name="ClassNamingConventions"/>
55 <exclude name="CommentDefaultAccessModifier"/>
56 <exclude name="ConfusingTernary"/>
57 <exclude name="ControlStatementBraces"/>
58 <exclude name="DefaultPackage"/>
59 <exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
60 <exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
61 <exclude name="FieldNamingConventions"/>
62 <exclude name="ForLoopsMustUseBraces"/>
63 <exclude name="IfElseStmtsMustUseBraces"/>
64 <exclude name="IfStmtsMustUseBraces"/>
65 <exclude name="LinguisticNaming"/>
66 <exclude name="LocalVariableCouldBeFinal"/>
67 <exclude name="LongVariable"/>
68 <exclude name="MethodArgumentCouldBeFinal"/>
69 <exclude name="MethodNamingConventions"/>
70 <exclude name="NoPackage"/>
71 <exclude name="OnlyOneReturn"/>
72 <exclude name="PrematureDeclaration"/>
73 <exclude name="ShortClassName"/>
74 <exclude name="ShortMethodName"/>
75 <exclude name="ShortVariable"/>
76 <exclude name="TooManyStaticImports"/>
77 <exclude name="UnnecessaryCast" reason="Introduced in 6.24, some positives in source code at this time"/>
78 <exclude name="UnnecessaryConstructor"/>
79 <exclude name="UseUnderscoresInNumericLiterals"/>
80 <exclude name="UselessParentheses"/>
81 <exclude name="VariableNamingConventions"/>
82 <exclude name="WhileLoopsMustUseBraces"/>
83 </rule>
84 <rule ref="category/java/codestyle.xml/ShortMethodName">
85 <properties>
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']"/>
89 </properties>
90 </rule>
91 <rule ref="category/java/codestyle.xml/MethodNamingConventions">
92 <properties>
93 <property name="violationSuppressXPath" value="//MethodDeclaration/../../..[@SimpleName='Functions' or @SimpleName='PseudoClasses' or @SimpleName='Role' or @SimpleName='TaggingPreset']"/>
94 </properties>
95 </rule>
96 <rule ref="category/java/codestyle.xml/FieldNamingConventions">
97 <properties>
98 <property name="enumConstantPattern" value="[A-Za-z][A-Za-z_0-9]*"/>
99 <property name="violationSuppressXPath" value="//FieldDeclaration[@Public='true']
100 | //FieldDeclaration/../Annotation/MarkerAnnotation/Name[@Image='pref']
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
108 @Image!='Integer' and
109 @Image!='Long' and
110 @Image!='Number' and
111 @Image!='Short' and
112 @Image!='String' ]"/>
113 </properties>
114 </rule>
115 <rule ref="category/java/codestyle.xml/LongVariable">
116 <properties>
117 <property name="minimum" value="44"/>
118 </properties>
119 </rule>
120 <rule ref="category/java/design.xml">
121 <exclude name="AvoidCatchingGenericException"/>
122 <exclude name="AvoidDeeplyNestedIfStmts"/>
123 <exclude name="AvoidRethrowingException"/>
124 <exclude name="CognitiveComplexity" reason="Introduced in 6.35, some number of positives in source code at this time"/>
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"/>
139 <exclude name="MutableStaticState" reason="Introduced in 6.35, some number of positives in source code at this time"/>
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"/>
152 </rule>
153 <rule ref="category/java/design.xml/SignatureDeclareThrowsException">
154 <properties>
155 <property name="violationSuppressXPath" value="//MethodDeclaration/../Annotation/MarkerAnnotation/Name[@Image='Override']"/>
156 <property name="IgnoreJUnitCompletely" value="true"/>
157 </properties>
158 </rule>
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"/>
170 <exclude name="CloneThrowsCloneNotSupportedException"/>
171 <!-- <exclude name="CloseResource"/> -->
172 <exclude name="CompareObjectsWithEquals"/>
173 <exclude name="ConstructorCallsOverridableMethod"/>
174 <exclude name="DataflowAnomalyAnalysis"/>
175 <exclude name="DoNotTerminateVM"/>
176 <exclude name="DontImportSun"/>
177 <exclude name="EmptyIfStmt"/>
178 <exclude name="EmptyWhileStmt"/>
179 <exclude name="ImplicitSwitchFallThrough"/>
180 <exclude name="MissingSerialVersionUID"/>
181 <exclude name="MissingStaticMethodInNonInstantiatableClass"/>
182 <exclude name="NonStaticInitializer"/>
183 <exclude name="NullAssignment"/>
184 <exclude name="ReturnEmptyArrayRatherThanNull"/>
185 <exclude name="ReturnEmptyCollectionRatherThanNull" reason="Introduced in 6.37, there are positives in source code at this time"/>
186 <exclude name="SimpleDateFormatNeedsLocale"/>
187 <exclude name="SingleMethodSingleton"/>
188 <exclude name="SingletonClassReturningNewInstance"/>
189 <exclude name="TestClassWithoutTestCases"/>
190 <exclude name="UseProperClassLoader"/>
191 </rule>
192 <rule ref="category/java/errorprone.xml/AvoidAccessibilityAlteration">
193 <properties>
194 <property name="violationSuppressXPath" value="//MethodDeclaration/../../..[@SimpleName='ReflectionUtils']"/>
195 </properties>
196 </rule>
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"/>
203 <exclude name="InsufficientStringBufferDeclaration" reason="PMD 6.40 has a bug where it doesn't properly count appended strings in if statements."/>
204 <exclude name="TooFewBranchesForASwitchStatement"/>
205 <exclude name="UseArrayListInsteadOfVector"/>
206 <exclude name="UselessStringValueOf"/>
207 <exclude name="UseStringBufferForStringAppends"/>
208 </rule>
209
210</ruleset>
Note: See TracBrowser for help on using the repository browser.