-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpmd-rulesets.xml
188 lines (178 loc) · 11.3 KB
/
pmd-rulesets.xml
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
<ruleset name="Custom Rules"
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.net/ruleset_2_0_0.xsd">
<description>
Custom Rulesets, extended from the default Maven PMD plugin (see target/pmd/rulesets/maven-pmd-plugin-default.xml)
More info:
https://pmd.github.io/latest/pmd_userdocs_making_rulesets.html
https://pmd.github.io/latest/pmd_userdocs_configuring_rules.html
https://maven.apache.org/plugins/maven-pmd-plugin/examples/usingRuleSets.html
</description>
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
<rule ref="category/java/bestpractices.xml/UnusedImports" />
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter" />
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod">
<!-- ignore 'unusedPrivateMethod' for private methods annotated with @PostConstruct -->
<properties>
<property name="violationSuppressXPath" value="ancestor::ClassOrInterfaceBodyDeclaration/Annotation/MarkerAnnotation/Name[@Image='PostConstruct']" />
</properties>
</rule>
<rule ref="category/java/codestyle.xml/DontImportJavaLang" />
<rule ref="category/java/codestyle.xml/DuplicateImports" />
<rule ref="category/java/codestyle.xml/ExtendsObject" />
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
<rule ref="category/java/codestyle.xml/TooManyStaticImports" />
<rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName" />
<rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
<rule ref="category/java/codestyle.xml/UselessParentheses" />
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
<rule ref="category/java/design.xml/CollapsibleIfStatements" />
<rule ref="category/java/design.xml/SimplifiedTernary" />
<rule ref="category/java/design.xml/UselessOverridingMethod" />
<!-- Error Prone -->
<rule ref="category/java/errorprone.xml/AssignmentInOperand" />
<rule ref="category/java/errorprone.xml/AssignmentToNonFinalStatic" />
<rule ref="category/java/errorprone.xml/AvoidAccessibilityAlteration" />
<rule ref="category/java/errorprone.xml/AvoidAssertAsIdentifier" />
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
<rule ref="category/java/errorprone.xml/AvoidCatchingNPE" />
<rule ref="category/java/errorprone.xml/AvoidCatchingThrowable" />
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
<rule ref="category/java/errorprone.xml/AvoidEnumAsIdentifier" />
<rule ref="category/java/errorprone.xml/AvoidFieldNameMatchingMethodName" />
<rule ref="category/java/errorprone.xml/AvoidFieldNameMatchingTypeName" />
<rule ref="category/java/errorprone.xml/AvoidInstanceofChecksInCatchClause" />
<rule ref="category/java/errorprone.xml/AvoidLosingExceptionInformation" />
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" />
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" />
<rule ref="category/java/errorprone.xml/BadComparison" />
<rule ref="category/java/errorprone.xml/BrokenNullCheck" />
<rule ref="category/java/errorprone.xml/CheckSkipResult" />
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" />
<rule ref="category/java/errorprone.xml/CloneMethodMustBePublic" />
<rule ref="category/java/errorprone.xml/CloneMethodMustImplementCloneable" />
<rule ref="category/java/errorprone.xml/CloneMethodReturnTypeMustMatchClassName" />
<rule ref="category/java/errorprone.xml/CloneThrowsCloneNotSupportedException" />
<rule ref="category/java/errorprone.xml/CloseResource" />
<rule ref="category/java/errorprone.xml/CompareObjectsWithEquals" />
<rule ref="category/java/errorprone.xml/ConstructorCallsOverridableMethod" />
<rule ref="category/java/errorprone.xml/DetachedTestCase" />
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly" />
<rule ref="category/java/errorprone.xml/DoNotExtendJavaLangThrowable" />
<rule ref="category/java/errorprone.xml/DoNotHardCodeSDCard" />
<rule ref="category/java/errorprone.xml/DoNotTerminateVM" />
<rule ref="category/java/errorprone.xml/DoNotThrowExceptionInFinally" />
<rule ref="category/java/errorprone.xml/DontImportSun" />
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
<rule ref="category/java/errorprone.xml/EmptyCatchBlock" />
<rule ref="category/java/errorprone.xml/EmptyFinallyBlock" />
<rule ref="category/java/errorprone.xml/EmptyIfStmt" />
<rule ref="category/java/errorprone.xml/EmptyInitializer" />
<rule ref="category/java/errorprone.xml/EmptyStatementBlock" />
<rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop" />
<rule ref="category/java/errorprone.xml/EmptySwitchStatements" />
<rule ref="category/java/errorprone.xml/EmptySynchronizedBlock" />
<rule ref="category/java/errorprone.xml/EmptyTryBlock" />
<rule ref="category/java/errorprone.xml/EmptyWhileStmt" />
<rule ref="category/java/errorprone.xml/EqualsNull" />
<rule ref="category/java/errorprone.xml/IdempotentOperations" />
<rule ref="category/java/errorprone.xml/ImportFromSamePackage" />
<rule ref="category/java/errorprone.xml/InstantiationToGetClass" />
<rule ref="category/java/errorprone.xml/InvalidLogMessageFormat" />
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
<rule ref="category/java/errorprone.xml/JUnitSpelling" />
<rule ref="category/java/errorprone.xml/JUnitStaticSuite" />
<rule ref="category/java/errorprone.xml/MethodWithSameNameAsEnclosingClass" />
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
<rule ref="category/java/errorprone.xml/MissingBreakInSwitch" />
<rule ref="category/java/errorprone.xml/MissingSerialVersionUID" />
<rule ref="category/java/errorprone.xml/MissingStaticMethodInNonInstantiatableClass" />
<rule ref="category/java/errorprone.xml/MoreThanOneLogger" />
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitchStatement" />
<rule ref="category/java/errorprone.xml/NonStaticInitializer" />
<rule ref="category/java/errorprone.xml/NullAssignment" />
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
<rule ref="category/java/errorprone.xml/ProperCloneImplementation" />
<rule ref="category/java/errorprone.xml/ReturnEmptyArrayRatherThanNull" />
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" />
<rule ref="category/java/errorprone.xml/SimpleDateFormatNeedsLocale" />
<rule ref="category/java/errorprone.xml/SingleMethodSingleton" />
<rule ref="category/java/errorprone.xml/SingletonClassReturningNewInstance" />
<rule ref="category/java/errorprone.xml/StaticEJBFieldShouldBeFinal" />
<rule ref="category/java/errorprone.xml/StringBufferInstantiationWithChar" />
<rule ref="category/java/errorprone.xml/SuspiciousEqualsMethodName" />
<rule ref="category/java/errorprone.xml/SuspiciousHashcodeMethodName" />
<rule ref="category/java/errorprone.xml/SuspiciousOctalEscape" />
<rule ref="category/java/errorprone.xml/TestClassWithoutTestCases" />
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement" />
<rule ref="category/java/errorprone.xml/UnnecessaryBooleanAssertion" />
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange" />
<rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary" />
<rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals" />
<rule ref="category/java/errorprone.xml/UseCorrectExceptionLogging" />
<rule ref="category/java/errorprone.xml/UseEqualsToCompareStrings" />
<rule ref="category/java/errorprone.xml/UselessOperationOnImmutable" />
<rule ref="category/java/errorprone.xml/UseLocaleWithCaseConversions" />
<rule ref="category/java/errorprone.xml/UseProperClassLoader" />
<!-- Multithreading -->
<rule ref="category/java/multithreading.xml/AvoidSynchronizedAtMethodLevel" />
<rule ref="category/java/multithreading.xml/AvoidThreadGroup" />
<rule ref="category/java/multithreading.xml/AvoidUsingVolatile" />
<rule ref="category/java/multithreading.xml/DoNotUseThreads" />
<rule ref="category/java/multithreading.xml/DontCallThreadRun" />
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking" />
<rule ref="category/java/multithreading.xml/NonThreadSafeSingleton">
<properties>
<property name="checkNonStaticMethods" value="true" />
<property name="checkNonStaticFields" value="false" />
</properties>
</rule>
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticFormatter">
<properties>
<property name="allowMethodLevelSynchronization" value="false" />
</properties>
</rule>
<!-- NEEDS TESTING - this discourages usage of HashMap / LinkedHashMap / TreeMap entirely, which seems suspicious
<rule ref="category/java/multithreading.xml/UseConcurrentHashMap" />
-->
<rule ref="category/java/multithreading.xml/UseNotifyAllInsteadOfNotify" />
<!-- Performance -->
<rule ref="category/java/performance.xml/AddEmptyString" />
<rule ref="category/java/performance.xml/AppendCharacterWithChar" />
<rule ref="category/java/performance.xml/AvoidArrayLoops" />
<rule ref="category/java/performance.xml/AvoidCalendarDateCreation" />
<rule ref="category/java/performance.xml/AvoidFileStream" />
<rule ref="category/java/performance.xml/AvoidInstantiatingObjectsInLoops" />
<rule ref="category/java/performance.xml/AvoidUsingShortType" />
<rule ref="category/java/performance.xml/BigIntegerInstantiation" />
<rule ref="category/java/performance.xml/ConsecutiveAppendsShouldReuse" />
<rule ref="category/java/performance.xml/ConsecutiveLiteralAppends" />
<rule ref="category/java/performance.xml/InefficientEmptyStringCheck" />
<rule ref="category/java/performance.xml/InefficientStringBuffering" />
<rule ref="category/java/performance.xml/InsufficientStringBufferDeclaration" />
<rule ref="category/java/performance.xml/OptimizableToArrayCall" />
<rule ref="category/java/performance.xml/RedundantFieldInitializer" />
<rule ref="category/java/performance.xml/SimplifyStartsWith" />
<rule ref="category/java/performance.xml/StringInstantiation" />
<rule ref="category/java/performance.xml/StringToString" />
<rule ref="category/java/performance.xml/TooFewBranchesForASwitchStatement">
<properties>
<property name="minimumNumberCaseForASwitch" value="3" />
</properties>
</rule>
<rule ref="category/java/performance.xml/UnnecessaryWrapperObjectCreation" />
<rule ref="category/java/performance.xml/UseArrayListInsteadOfVector" />
<rule ref="category/java/performance.xml/UseArraysAsList" />
<rule ref="category/java/performance.xml/UseIndexOfChar" />
<rule ref="category/java/performance.xml/UseIOStreamsWithApacheCommonsFileItem" />
<rule ref="category/java/performance.xml/UselessStringValueOf" />
<rule ref="category/java/performance.xml/UseStringBufferForStringAppends" />
<rule ref="category/java/performance.xml/UseStringBufferLength" />
<!-- Security -->
<rule ref="category/java/security.xml/HardCodedCryptoKey" />
<rule ref="category/java/security.xml/InsecureCryptoIv" />
</ruleset>