-
Notifications
You must be signed in to change notification settings - Fork 89
/
.ruleset
267 lines (258 loc) · 14.9 KB
/
.ruleset
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="http://pmd.sf.net/ruleset/1.0.0" name="pmd-eclipse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Mifos PMD ruleset</description>
<rule ref="rulesets/typeresolution.xml/LooseCoupling"/>
<rule ref="rulesets/typeresolution.xml/CloneMethodMustImplementCloneable"/>
<rule ref="rulesets/typeresolution.xml/UnusedImports"/>
<rule ref="rulesets/typeresolution.xml/SignatureDeclareThrowsException"/>
<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>
<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>
<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>
<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>
<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>
<rule ref="rulesets/controversial.xml/NullAssignment"/>
<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>
<rule ref="rulesets/controversial.xml/UnusedModifier"/>
<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>
<rule ref="rulesets/controversial.xml/DontImportSun"/>
<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>
<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>
<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
<!-- should only apply to fields
<rule ref="rulesets/controversial.xml/DefaultPackage"/> -->
<rule ref="rulesets/controversial.xml/BooleanInversion"/>
<!--
This rule complains about constructs that have no alternative, such as
SomeClass foo = null;
try {
foo = somevalue;
finally {
cleanup(foo);
}
For a specific Cheetah example, see discussion at http://tinyurl.com/4ltc6t
<rule ref="rulesets/controversial.xml/DataflowAnomalyAnalysis"/>
-->
<rule ref="rulesets/controversial.xml/AvoidFinalLocalVariable"/>
<rule ref="rulesets/controversial.xml/AvoidUsingShortType"/>
<rule ref="rulesets/controversial.xml/AvoidUsingVolatile"/>
<rule ref="rulesets/controversial.xml/AvoidUsingNativeCode"/>
<rule ref="rulesets/controversial.xml/AvoidAccessibilityAlteration"/>
<rule ref="rulesets/controversial.xml/DoNotCallGarbageCollectionExplicitly"/>
<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>
<rule ref="rulesets/basic.xml/EmptyIfStmt"/>
<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>
<rule ref="rulesets/basic.xml/EmptyTryBlock"/>
<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>
<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>
<rule ref="rulesets/basic.xml/JumbledIncrementer"/>
<rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
<rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>
<rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
<rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>
<rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>
<rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
<rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
<rule ref="rulesets/basic.xml/BooleanInstantiation"/>
<rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
<rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>
<rule ref="rulesets/basic.xml/ClassCastExceptionWithToArray"/>
<rule ref="rulesets/basic.xml/AvoidDecimalLiteralsInBigDecimalConstructor"/>
<rule ref="rulesets/basic.xml/UselessOperationOnImmutable"/>
<rule ref="rulesets/basic.xml/MisplacedNullCheck"/>
<rule ref="rulesets/basic.xml/UnusedNullCheckInEquals"/>
<rule ref="rulesets/basic.xml/AvoidThreadGroup"/>
<rule ref="rulesets/basic.xml/BrokenNullCheck"/>
<rule ref="rulesets/basic.xml/BigIntegerInstantiation"/>
<rule ref="rulesets/basic.xml/AvoidUsingOctalValues"/>
<rule ref="rulesets/basic.xml/AvoidUsingHardCodedIP"/>
<rule ref="rulesets/basic.xml/CheckResultSet"/>
<rule ref="rulesets/basic.xml/AvoidMultipleUnaryOperators"/>
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>
<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>
<rule ref="rulesets/logging-java.xml/SystemPrintln"/>
<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>
<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>
<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>
<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>
<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>
<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>
<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>
<rule ref="rulesets/strictexception.xml/AvoidRethrowingException"/>
<rule ref="rulesets/strictexception.xml/DoNotExtendJavaLangError"/>
<rule ref="rulesets/strictexception.xml/DoNotThrowExceptionInFinally"/>
<!-- disabling to allow static enums - reenable if you can get @SuppressWarnings to work on them.
<rule ref="rulesets/design.xml/UseSingleton"/>
-->
<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>
<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>
<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>
<rule ref="rulesets/design.xml/SwitchDensity"/>
<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
<rule ref="rulesets/design.xml/AccessorClassGeneration"/>
<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>
<rule ref="rulesets/design.xml/CloseResource"/>
<rule ref="rulesets/design.xml/NonStaticInitializer"/>
<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>
<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>
<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
<rule ref="rulesets/design.xml/BadComparison"/>
<rule ref="rulesets/design.xml/EqualsNull"/>
<rule ref="rulesets/design.xml/ConfusingTernary"/>
<rule ref="rulesets/design.xml/InstantiationToGetClass"/>
<rule ref="rulesets/design.xml/IdempotentOperations"/>
<rule ref="rulesets/design.xml/SimpleDateFormatNeedsLocale"/>
<rule ref="rulesets/design.xml/ImmutableField"/>
<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>
<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>
<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>
<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>
<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>
<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>
<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>
<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>
<rule ref="rulesets/design.xml/SimplifyConditional"/>
<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>
<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
<rule ref="rulesets/design.xml/NonThreadSafeSingleton"/>
<rule ref="rulesets/design.xml/UncommentedEmptyMethod"/>
<rule ref="rulesets/design.xml/UncommentedEmptyConstructor"/>
<rule ref="rulesets/design.xml/AvoidConstantsInterface"/>
<rule ref="rulesets/design.xml/UnsynchronizedStaticDateFormatter"/>
<rule ref="rulesets/design.xml/PreserveStackTrace"/>
<rule ref="rulesets/design.xml/UseCollectionIsEmpty"/>
<rule ref="rulesets/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal"/>
<rule ref="rulesets/design.xml/EmptyMethodInAbstractClassShouldBeAbstract"/>
<rule ref="rulesets/design.xml/SingularField"/>
<rule ref="rulesets/design.xml/ReturnEmptyArrayRatherThanNull"/>
<rule ref="rulesets/design.xml/AbstractClassWithoutAnyMethod"/>
<rule ref="rulesets/design.xml/TooFewBranchesForASwitchStatement"/>
<!-- Not sure we want to enforce these
<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>
<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/> -->
<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>
<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>
<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>
<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>
<rule ref="rulesets/optimizations.xml/UseArraysAsList"/>
<rule ref="rulesets/optimizations.xml/AvoidArrayLoops"/>
<rule ref="rulesets/optimizations.xml/UnnecessaryWrapperObjectCreation"/>
<rule ref="rulesets/optimizations.xml/AddEmptyString"/>
<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>
<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>
<!--
<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/> -->
<!--
<rule ref="rulesets/coupling.xml/ExcessiveImports"/> -->
<rule ref="rulesets/coupling.xml/LooseCoupling"/>
<rule ref="rulesets/imports.xml/DuplicateImports"/>
<rule ref="rulesets/imports.xml/DontImportJavaLang"/>
<rule ref="rulesets/imports.xml/UnusedImports"/>
<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>
<rule ref="rulesets/imports.xml/TooManyStaticImports"/>
<!--
<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>
<rule ref="rulesets/junit.xml/JUnitSpelling"/>
<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>
<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>
<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>
-->
<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>
<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>
<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>
<rule ref="rulesets/junit.xml/UseAssertNullInsteadOfAssertTrue"/>
<rule ref="rulesets/junit.xml/SimplifyBooleanAssertion"/>
<!--
<rule ref="rulesets/naming.xml/ShortVariable"/>
<rule ref="rulesets/naming.xml/LongVariable"/> -->
<rule ref="rulesets/naming.xml/ShortMethodName"/>
<rule ref="rulesets/naming.xml/VariableNamingConventions"/>
<rule ref="rulesets/naming.xml/MethodNamingConventions"/>
<rule ref="rulesets/naming.xml/ClassNamingConventions"/>
<rule ref="rulesets/naming.xml/AbstractNaming"/>
<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>
<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>
<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>
<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>
<rule ref="rulesets/naming.xml/SuspiciousEqualsMethodName"/>
<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>
<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>
<rule ref="rulesets/naming.xml/NoPackage"/>
<rule ref="rulesets/naming.xml/PackageCase"/>
<rule ref="rulesets/naming.xml/MisleadingVariableName"/>
<rule ref="rulesets/naming.xml/BooleanGetMethodName"/>
<rule ref="rulesets/codesize.xml/NPathComplexity"/>
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>
<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>
<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>
<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>
<!-- <rule ref="rulesets/codesize.xml/ExcessivePublicCount"/> ignored as could not suppress using pmd annotation and wasn't valid for form backing beans in userInterfaces module -keithw- -->
<rule ref="rulesets/codesize.xml/TooManyFields"/>
<rule ref="rulesets/codesize.xml/NcssMethodCount"/>
<rule ref="rulesets/codesize.xml/NcssTypeCount"/>
<rule ref="rulesets/codesize.xml/NcssConstructorCount"/>
<!-- test classes have many methods
<rule ref="rulesets/codesize.xml/TooManyMethods"/> -->
<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>
<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>
<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>
<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>
<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>
<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>
<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>
<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>
<!-- doesn't seem to apply for tests, but could be useful for production code
<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/> -->
<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>
<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>
<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>
<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>
<!-- This rule was triggered by testng annotations
<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/> -->
<rule ref="rulesets/strings.xml/StringInstantiation"/>
<rule ref="rulesets/strings.xml/StringToString"/>
<rule ref="rulesets/strings.xml/InefficientStringBuffering"/>
<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>
<rule ref="rulesets/strings.xml/UseStringBufferLength"/>
<rule ref="rulesets/strings.xml/AppendCharacterWithChar"/>
<!--
<rule ref="rulesets/strings.xml/ConsecutiveLiteralAppends"/> -->
<rule ref="rulesets/strings.xml/UseIndexOfChar"/>
<rule ref="rulesets/strings.xml/InefficientEmptyStringCheck"/>
<rule ref="rulesets/strings.xml/InsufficientStringBufferDeclaration"/>
<rule ref="rulesets/strings.xml/UselessStringValueOf"/>
<rule ref="rulesets/strings.xml/StringBufferInstantiationWithChar"/>
<rule ref="rulesets/strings.xml/UseEqualsToCompareStrings"/>
<rule ref="rulesets/strings.xml/AvoidStringBufferField"/>
</ruleset>
<!-- using an entire ruleset
<rule ref="rulesets/basic.xml"/>
Comment: We want to customize this rule a bit, change the message and raise the priority
<rule
ref="rulesets/basic.xml/EmptyCatchBlock"
message="Must handle exceptions">
<priority>2</priority>
</rule>
Comment: Now we'll customize a rule's property value
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
<properties>
<property name="reportLevel" value="5"/>
</properties>
</rule>
Comment: Note we want everything from braces.xml except WhileLoopsMustUseBraces
<rule ref="rulesets/braces.xml">
<exclude name="WhileLoopsMustUseBraces"/>
</rule>
-->