-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPMD.Rules.xml
157 lines (148 loc) · 10 KB
/
PMD.Rules.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
<?xml version="1.0"?>
<ruleset name="Custom ruleset for CS4218"
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.io/ruleset_2_0_0.xsd">
<description>
This ruleset checks for violations of code conventions and code smells.
Last updated 9 January 2021 (Replaced deprecated rulesets with its equivalent)
</description>
<!-- Replacement for deprecated rulesets/java/basic.xml -->
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" />
<rule ref="category/java/multithreading.xml/AvoidThreadGroup" />
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" />
<rule ref="category/java/performance.xml/BigIntegerInstantiation" />
<rule ref="category/java/performance.xml/BooleanInstantiation" />
<rule ref="category/java/errorprone.xml/BrokenNullCheck" />
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
<rule ref="category/java/errorprone.xml/CheckSkipResult" />
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" />
<rule ref="category/java/design.xml/CollapsibleIfStatements" />
<rule ref="category/java/multithreading.xml/DontCallThreadRun" />
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking" />
<rule ref="category/java/codestyle.xml/ExtendsObject" />
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" />
<rule ref="category/java/design.xml/SimplifiedTernary" />
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement" />
<!-- Replacement for deprecated rulesets/java/braces.xml -->
<rule ref="category/java/codestyle.xml/ForLoopsMustUseBraces" />
<rule ref="category/java/codestyle.xml/IfElseStmtsMustUseBraces" />
<rule ref="category/java/codestyle.xml/IfStmtsMustUseBraces" />
<rule ref="category/java/codestyle.xml/WhileLoopsMustUseBraces" />
<rule ref="category/java/design.xml/ExcessiveMethodLength">
<properties>
<property name="minimum" value="50.0" />
</properties>
</rule>
<!-- Replacement for deprecated rulesets/java/design.xml -->
<rule ref="category/java/bestpractices.xml/AbstractClassWithoutAbstractMethod" />
<rule ref="category/java/design.xml/AbstractClassWithoutAnyMethod" />
<rule ref="category/java/bestpractices.xml/AccessorClassGeneration" />
<rule ref="category/java/bestpractices.xml/AccessorMethodGeneration" />
<rule ref="category/java/errorprone.xml/AssignmentToNonFinalStatic" />
<rule ref="category/java/design.xml/AvoidDeeplyNestedIfStmts" />
<rule ref="category/java/errorprone.xml/AvoidInstanceofChecksInCatchClause" />
<rule ref="category/java/codestyle.xml/AvoidProtectedFieldInFinalClass" />
<rule ref="category/java/codestyle.xml/AvoidProtectedMethodInFinalClassNotExtending" />
<rule ref="category/java/bestpractices.xml/AvoidReassigningParameters" />
<rule ref="category/java/multithreading.xml/AvoidSynchronizedAtMethodLevel" />
<rule ref="category/java/errorprone.xml/BadComparison" />
<rule ref="category/java/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal" />
<!-- <rule ref="category/java/errorprone.xml/CloseResource" />-->
<rule ref="category/java/errorprone.xml/CompareObjectsWithEquals" />
<rule ref="category/java/codestyle.xml/ConfusingTernary" />
<rule ref="category/java/bestpractices.xml/ConstantsInInterface" />
<rule ref="category/java/errorprone.xml/ConstructorCallsOverridableMethod" />
<rule ref="category/java/design.xml/DataClass" />
<rule ref="category/java/bestpractices.xml/DefaultLabelNotLastInSwitchStmt" />
<rule ref="category/java/codestyle.xml/EmptyMethodInAbstractClassShouldBeAbstract" />
<rule ref="category/java/errorprone.xml/EqualsNull" />
<rule ref="category/java/codestyle.xml/FieldDeclarationsShouldBeAtStartOfClass" />
<rule ref="category/java/design.xml/FinalFieldCouldBeStatic" />
<!-- <rule ref="category/java/design.xml/GodClass" />-->
<rule ref="category/java/errorprone.xml/IdempotentOperations" />
<rule ref="category/java/design.xml/ImmutableField" />
<rule ref="category/java/errorprone.xml/InstantiationToGetClass" />
<rule ref="category/java/design.xml/LogicInversion" />
<rule ref="category/java/errorprone.xml/MissingBreakInSwitch" />
<rule ref="category/java/errorprone.xml/MissingStaticMethodInNonInstantiatableClass" />
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitchStatement" />
<rule ref="category/java/errorprone.xml/NonStaticInitializer" />
<rule ref="category/java/multithreading.xml/NonThreadSafeSingleton" />
<rule ref="category/java/performance.xml/OptimizableToArrayCall" />
<rule ref="category/java/bestpractices.xml/PositionLiteralsFirstInCaseInsensitiveComparisons" />
<rule ref="category/java/bestpractices.xml/PositionLiteralsFirstInComparisons" />
<!-- <rule ref="category/java/bestpractices.xml/PreserveStackTrace" />-->
<rule ref="category/java/errorprone.xml/ReturnEmptyArrayRatherThanNull" />
<rule ref="category/java/errorprone.xml/SimpleDateFormatNeedsLocale" />
<rule ref="category/java/design.xml/SimplifyBooleanExpressions" />
<rule ref="category/java/design.xml/SimplifyBooleanReturns" />
<rule ref="category/java/design.xml/SimplifyConditional" />
<rule ref="category/java/errorprone.xml/SingleMethodSingleton" />
<rule ref="category/java/errorprone.xml/SingletonClassReturningNewInstance" />
<rule ref="category/java/design.xml/SingularField" />
<rule ref="category/java/design.xml/SwitchDensity" />
<rule ref="category/java/bestpractices.xml/SwitchStmtsShouldHaveDefault" />
<rule ref="category/java/performance.xml/TooFewBranchesForASwitchStatement" />
<rule ref="category/java/documentation.xml/UncommentedEmptyConstructor" />
<rule ref="category/java/documentation.xml/UncommentedEmptyMethodBody" />
<rule ref="category/java/codestyle.xml/UnnecessaryLocalBeforeReturn" />
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticDateFormatter" />
<rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty" />
<rule ref="category/java/errorprone.xml/UseLocaleWithCaseConversions" />
<rule ref="category/java/multithreading.xml/UseNotifyAllInsteadOfNotify" />
<rule ref="category/java/design.xml/UseUtilityClass" />
<rule ref="category/java/bestpractices.xml/UseVarargs" />
<!-- Replacement for deprecated rulesets/java/naming.xml -->
<rule ref="category/java/codestyle.xml/AbstractNaming" />
<rule ref="category/java/codestyle.xml/AvoidDollarSigns" />
<rule ref="category/java/errorprone.xml/AvoidFieldNameMatchingMethodName" />
<rule ref="category/java/errorprone.xml/AvoidFieldNameMatchingTypeName" />
<rule ref="category/java/codestyle.xml/BooleanGetMethodName" />
<!-- <rule ref="category/java/codestyle.xml/ClassNamingConventions" />-->
<rule ref="category/java/codestyle.xml/GenericsNaming" />
<rule ref="category/java/codestyle.xml/LongVariable" />
<rule ref="category/java/codestyle.xml/MethodNamingConventions">
<properties>
<!-- To enforce test[method/feature being tested]When[Scenario]Should[Return/Throw][expected][If throw then must end with Exception] junit method naming convention. Only for Junit 5 -->
<property name="junit5TestPattern" value="[a-z][a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9]+" />
</properties>
</rule>
<rule ref="category/java/errorprone.xml/MethodWithSameNameAsEnclosingClass" />
<rule ref="category/java/codestyle.xml/LocalVariableNamingConventions" /> <!-- As in future PMD version 7.0.0 MIsLeadingVariableName will be deprecated and removed according to documentation -->
<rule ref="category/java/codestyle.xml/MIsLeadingVariableName" />
<rule ref="category/java/codestyle.xml/NoPackage" />
<rule ref="category/java/codestyle.xml/PackageCase" />
<rule ref="category/java/codestyle.xml/ShortClassName" />
<rule ref="category/java/codestyle.xml/ShortMethodName" />
<rule ref="category/java/codestyle.xml/ShortVariable" />
<rule ref="category/java/codestyle.xml/SuspiciousConstantFieldName" />
<rule ref="category/java/errorprone.xml/SuspiciousEqualsMethodName" />
<rule ref="category/java/errorprone.xml/SuspiciousHashcodeMethodName" />
<rule ref="category/java/codestyle.xml/VariableNamingConventions" />
<!-- Replacement for deprecated rulesets/java/strings.xml -->
<rule ref="category/java/performance.xml/AppendCharacterWithChar" />
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals" />
<rule ref="category/java/bestpractices.xml/AvoidStringBufferField" />
<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/errorprone.xml/StringBufferInstantiationWithChar" />
<rule ref="category/java/performance.xml/StringInstantiation" />
<rule ref="category/java/performance.xml/StringToString" />
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange" />
<rule ref="category/java/errorprone.xml/UseEqualsToCompareStrings" />
<rule ref="category/java/performance.xml/UseIndexOfChar" />
<rule ref="category/java/performance.xml/UselessStringValueOf" />
<rule ref="category/java/performance.xml/UseStringBufferLength" />
</ruleset>