1+ <?xml version =" 1.0" ?>
2+
3+ <ruleset name =" Custom Rules"
4+ xmlns =" http://pmd.sourceforge.net/ruleset/2.0.0"
5+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
6+ xsi : schemaLocation =" http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd" >
7+
8+ <description >
9+ My custom PMD Rules
10+ </description >
11+
12+ <!-- BEST PRACTICES -->
13+ <rule ref =" category/java/bestpractices.xml/AbstractClassWithoutAbstractMethod" />
14+ <rule ref =" category/java/bestpractices.xml/AvoidPrintStackTrace" />
15+ <rule ref =" category/java/bestpractices.xml/AvoidStringBufferField" />
16+ <rule ref =" category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
17+ <rule ref =" category/java/bestpractices.xml/CheckResultSet" />
18+ <rule ref =" category/java/bestpractices.xml/ConstantsInInterface" />
19+ <rule ref =" category/java/bestpractices.xml/DefaultLabelNotLastInSwitchStmt" />
20+ <rule ref =" category/java/bestpractices.xml/ForLoopCanBeForeach" />
21+ <!-- <rule ref="category/java/bestpractices.xml/GuardLogStatement"/> -->
22+ <!-- <rule ref="category/java/bestpractices.xml/JUnit4SuitesShouldUseSuiteAnnotation" /> -->
23+ <!-- <rule ref="category/java/bestpractices.xml/JUnit4TestShouldUseAfterAnnotation" /> -->
24+ <!-- <rule ref="category/java/bestpractices.xml/JUnit4TestShouldUseBeforeAnnotation" /> -->
25+ <!-- <rule ref="category/java/bestpractices.xml/JUnit4TestShouldUseTestAnnotation" /> -->
26+ <!-- <rule ref="category/java/bestpractices.xml/JUnitAssertionsShouldIncludeMessage" /> -->
27+ <!-- <rule ref="category/java/bestpractices.xml/JUnitTestContainsTooManyAsserts" /> -->
28+ <!-- <rule ref="category/java/bestpractices.xml/JUnitTestsShouldIncludeAssert" /> -->
29+ <rule ref =" category/java/bestpractices.xml/JUnitUseExpected" />
30+ <rule ref =" category/java/bestpractices.xml/LooseCoupling" />
31+ <rule ref =" category/java/bestpractices.xml/MissingOverride" />
32+
33+ <rule ref =" category/java/bestpractices.xml/OneDeclarationPerLine" />
34+ <rule ref =" category/java/bestpractices.xml/PositionLiteralsFirstInCaseInsensitiveComparisons" />
35+ <rule ref =" category/java/bestpractices.xml/PositionLiteralsFirstInComparisons" />
36+ <rule ref =" category/java/bestpractices.xml/PreserveStackTrace" />
37+ <rule ref =" category/java/bestpractices.xml/SwitchStmtsShouldHaveDefault" />
38+ <rule ref =" category/java/bestpractices.xml/SystemPrintln" />
39+ <rule ref =" category/java/bestpractices.xml/UnusedFormalParameter" />
40+ <rule ref =" category/java/bestpractices.xml/UnusedImports" />
41+ <rule ref =" category/java/errorprone.xml/ImportFromSamePackage" />
42+ <rule ref =" category/java/bestpractices.xml/UnusedLocalVariable" />
43+ <rule ref =" category/java/bestpractices.xml/UnusedPrivateField" />
44+ <rule ref =" category/java/bestpractices.xml/UnusedPrivateMethod" />
45+ <rule ref =" category/java/bestpractices.xml/UseAssertEqualsInsteadOfAssertTrue" />
46+ <rule ref =" category/java/bestpractices.xml/UseAssertNullInsteadOfAssertTrue" />
47+ <rule ref =" category/java/bestpractices.xml/UseAssertSameInsteadOfAssertTrue" />
48+ <rule ref =" category/java/bestpractices.xml/UseAssertTrueInsteadOfAssertEquals" />
49+ <rule ref =" category/java/bestpractices.xml/UseCollectionIsEmpty" />
50+
51+ <rule ref =" category/java/codestyle.xml/AvoidDollarSigns" />
52+ <rule ref =" category/java/codestyle.xml/AvoidProtectedFieldInFinalClass" />
53+ <rule ref =" category/java/codestyle.xml/AvoidProtectedMethodInFinalClassNotExtending" />
54+
55+ <!-- NAMING CONVENTIONS -->
56+ <rule ref =" category/java/codestyle.xml/FormalParameterNamingConventions" />
57+ <rule ref =" category/java/codestyle.xml/ClassNamingConventions" />
58+ <rule ref =" category/java/codestyle.xml/LocalVariableNamingConventions" />
59+ <rule ref =" category/java/codestyle.xml/MethodNamingConventions" />
60+ <rule ref =" category/java/codestyle.xml/PackageCase" />
61+
62+ <!-- UNIMPLEMENTED -->
63+ <rule ref =" category/java/codestyle.xml/FieldNamingConventions" />
64+ <rule ref =" category/java/codestyle.xml/GenericsNaming" />
65+
66+ <rule ref =" category/java/codestyle.xml/LongVariable" >
67+ <properties >
68+ <property name =" minimum" value =" 25" />
69+ </properties >
70+ </rule >
71+ <rule ref =" category/java/codestyle.xml/ShortClassName" />
72+ <rule ref =" category/java/codestyle.xml/ShortMethodName" />
73+ <rule ref =" category/java/codestyle.xml/ShortVariable" />
74+
75+ <!-- OTHER -->
76+ <rule ref =" category/java/codestyle.xml/AvoidUsingNativeCode" />
77+ <rule ref =" category/java/codestyle.xml/BooleanGetMethodName" />
78+ <rule ref =" category/java/codestyle.xml/ConfusingTernary" />
79+ <rule ref =" category/java/codestyle.xml/ControlStatementBraces" />
80+ <rule ref =" category/java/codestyle.xml/DontImportJavaLang" />
81+ <rule ref =" category/java/codestyle.xml/DuplicateImports" />
82+ <rule ref =" category/java/codestyle.xml/EmptyMethodInAbstractClassShouldBeAbstract" />
83+ <rule ref =" category/java/codestyle.xml/ExtendsObject" />
84+ <rule ref =" category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
85+ <rule ref =" category/java/codestyle.xml/IdenticalCatchBranches" />
86+ <!-- <rule ref="category/java/codestyle.xml/LocalVariableCouldBeFinal" /> -->
87+ <!-- <rule ref="category/java/codestyle.xml/MethodArgumentCouldBeFinal" /> -->
88+ <rule ref =" category/java/codestyle.xml/NoPackage" />
89+ <rule ref =" category/java/codestyle.xml/TooManyStaticImports" >
90+ <properties >
91+ <property name =" maximumStaticImports" value =" 5" />
92+ </properties >
93+ </rule >
94+ <rule ref =" category/java/codestyle.xml/UnnecessaryAnnotationValueElement" />
95+ <rule ref =" category/java/codestyle.xml/UnnecessaryConstructor" />
96+ <rule ref =" category/java/codestyle.xml/UnnecessaryFullyQualifiedName" />
97+ <rule ref =" category/java/codestyle.xml/UnnecessaryLocalBeforeReturn" />
98+ <rule ref =" category/java/codestyle.xml/UnnecessaryModifier" />
99+ <rule ref =" category/java/codestyle.xml/UnnecessaryReturn" />
100+ <rule ref =" category/java/codestyle.xml/UselessParentheses" />
101+ <rule ref =" category/java/codestyle.xml/UselessQualifiedThis" />
102+
103+ <rule ref =" category/java/design.xml/AbstractClassWithoutAnyMethod" />
104+ <rule ref =" category/java/design.xml/AvoidDeeplyNestedIfStmts" />
105+ <rule ref =" category/java/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal" />
106+ <rule ref =" category/java/design.xml/CouplingBetweenObjects" />
107+ <rule ref =" category/java/design.xml/ExcessiveMethodLength" />
108+ <rule ref =" category/java/design.xml/ExcessiveParameterList" />
109+ <rule ref =" category/java/design.xml/ExcessivePublicCount" />
110+ <rule ref =" category/java/design.xml/FinalFieldCouldBeStatic" />
111+ <rule ref =" category/java/design.xml/LogicInversion" />
112+
113+ <rule ref =" category/java/design.xml/CyclomaticComplexity" />
114+ <rule ref =" category/java/design.xml/NPathComplexity" />
115+ <rule ref =" category/java/design.xml/SimplifiedTernary" />
116+ <rule ref =" category/java/design.xml/SimplifyBooleanReturns" />
117+ <rule ref =" category/java/design.xml/SimplifyConditional" />
118+ <rule ref =" category/java/design.xml/SingularField" />
119+ <rule ref =" category/java/design.xml/SwitchDensity" />
120+ <rule ref =" category/java/design.xml/TooManyFields" />
121+ <rule ref =" category/java/design.xml/TooManyMethods" >
122+ <properties >
123+ <property name =" maxmethods" value =" 20" />
124+ </properties >
125+ </rule >
126+ <rule ref =" category/java/design.xml/UselessOverridingMethod" />
127+ <rule ref =" category/java/design.xml/UseUtilityClass" />
128+
129+ <rule ref =" category/java/documentation.xml/UncommentedEmptyConstructor" />
130+ <rule ref =" category/java/documentation.xml/UncommentedEmptyMethodBody" />
131+
132+ <rule ref =" category/java/errorprone.xml/AssignmentInOperand" >
133+ <properties >
134+ <property name =" allowWhile" value =" true" />
135+ </properties >
136+ </rule >
137+ <rule ref =" category/java/errorprone.xml/AssignmentToNonFinalStatic" />
138+ <rule ref =" category/java/errorprone.xml/AvoidAccessibilityAlteration" />
139+ <rule ref =" category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
140+ <rule ref =" category/java/errorprone.xml/AvoidCatchingThrowable" />
141+ <rule ref =" category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
142+ <rule ref =" category/java/errorprone.xml/AvoidInstanceofChecksInCatchClause" />
143+ <rule ref =" category/java/errorprone.xml/AvoidMultipleUnaryOperators" />
144+ <rule ref =" category/java/errorprone.xml/AvoidUsingOctalValues" />
145+ <rule ref =" category/java/errorprone.xml/BadComparison" />
146+ <rule ref =" category/java/errorprone.xml/BrokenNullCheck" />
147+ <rule ref =" category/java/errorprone.xml/CheckSkipResult" />
148+ <rule ref =" category/java/errorprone.xml/ClassCastExceptionWithToArray" />
149+ <rule ref =" category/java/errorprone.xml/CloneMethodMustBePublic" />
150+ <rule ref =" category/java/errorprone.xml/CloneMethodMustImplementCloneable" />
151+ <rule ref =" category/java/errorprone.xml/CloneMethodReturnTypeMustMatchClassName" />
152+ <rule ref =" category/java/errorprone.xml/CloneThrowsCloneNotSupportedException" />
153+ <rule ref =" category/java/errorprone.xml/CloseResource" />
154+ <rule ref =" category/java/errorprone.xml/CompareObjectsWithEquals" />
155+ <rule ref =" category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly" />
156+
157+ <rule ref =" category/java/errorprone.xml/DoNotExtendJavaLangThrowable" />
158+ <rule ref =" category/java/design.xml/DoNotExtendJavaLangError" />
159+
160+ <rule ref =" category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
161+ <rule ref =" category/java/errorprone.xml/EmptyCatchBlock" />
162+
163+ <!-- EMPTY RULES -->
164+ <rule ref =" category/java/errorprone.xml/EmptyFinalizer" />
165+ <rule ref =" category/java/errorprone.xml/EmptyFinallyBlock" />
166+ <rule ref =" category/java/errorprone.xml/EmptyIfStmt" />
167+ <rule ref =" category/java/errorprone.xml/EmptyInitializer" />
168+ <rule ref =" category/java/errorprone.xml/EmptyStatementBlock" />
169+ <rule ref =" category/java/errorprone.xml/EmptyStatementNotInLoop" />
170+ <rule ref =" category/java/errorprone.xml/EmptySwitchStatements" />
171+ <rule ref =" category/java/errorprone.xml/EmptySynchronizedBlock" />
172+ <rule ref =" category/java/errorprone.xml/EmptyTryBlock" />
173+ <rule ref =" category/java/errorprone.xml/EmptyWhileStmt" />
174+
175+ <rule ref =" category/java/errorprone.xml/EqualsNull" />
176+
177+ <rule ref =" category/java/errorprone.xml/IdempotentOperations" />
178+ <rule ref =" category/java/errorprone.xml/InstantiationToGetClass" />
179+ <rule ref =" category/java/errorprone.xml/JumbledIncrementer" />
180+ <rule ref =" category/java/errorprone.xml/MisplacedNullCheck" />
181+ <rule ref =" category/java/errorprone.xml/MissingBreakInSwitch" />
182+ <rule ref =" category/java/errorprone.xml/MissingStaticMethodInNonInstantiatableClass" />
183+ <rule ref =" category/java/errorprone.xml/MoreThanOneLogger" />
184+ <rule ref =" category/java/errorprone.xml/NonCaseLabelInSwitchStatement" />
185+ <rule ref =" category/java/errorprone.xml/NonStaticInitializer" />
186+ <rule ref =" category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
187+ <rule ref =" category/java/errorprone.xml/ProperCloneImplementation" />
188+ <rule ref =" category/java/errorprone.xml/ProperLogger" />
189+ <rule ref =" category/java/errorprone.xml/ReturnEmptyArrayRatherThanNull" />
190+ <rule ref =" category/java/errorprone.xml/ReturnFromFinallyBlock" />
191+ <rule ref =" category/java/errorprone.xml/SingleMethodSingleton" />
192+ <rule ref =" category/java/errorprone.xml/SingletonClassReturningNewInstance" />
193+ <rule ref =" category/java/errorprone.xml/SuspiciousEqualsMethodName" />
194+ <rule ref =" category/java/errorprone.xml/SuspiciousHashcodeMethodName" />
195+ <rule ref =" category/java/errorprone.xml/SuspiciousOctalEscape" />
196+ <rule ref =" category/java/errorprone.xml/UnconditionalIfStatement" />
197+ <rule ref =" category/java/errorprone.xml/UnnecessaryConversionTemporary" />
198+ <rule ref =" category/java/errorprone.xml/UnusedNullCheckInEquals" />
199+ <rule ref =" category/java/errorprone.xml/UseEqualsToCompareStrings" />
200+ <rule ref =" category/java/errorprone.xml/UselessOperationOnImmutable" />
201+
202+ <rule ref =" category/java/multithreading.xml/AvoidThreadGroup" />
203+ <rule ref =" category/java/multithreading.xml/AvoidUsingVolatile" />
204+ <rule ref =" category/java/multithreading.xml/DontCallThreadRun" />
205+ <rule ref =" category/java/multithreading.xml/DoubleCheckedLocking" />
206+ <rule ref =" category/java/multithreading.xml/NonThreadSafeSingleton" />
207+ <rule ref =" category/java/multithreading.xml/UseNotifyAllInsteadOfNotify" />
208+
209+ <rule ref =" category/java/performance.xml/BigIntegerInstantiation" />
210+ <rule ref =" category/java/performance.xml/BooleanInstantiation" />
211+ <rule ref =" category/java/performance.xml/OptimizableToArrayCall" />
212+ <rule ref =" category/java/performance.xml/TooFewBranchesForASwitchStatement" />
213+ </ruleset >
0 commit comments