Newer
Older
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
<?xml version="1.0"?>
<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="pmd"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>
DNA analyser PMD ruleset
</description>
<!-- https://pmd.github.io/latest/pmd_rules_java.html -->
<rule ref="category/java/bestpractices.xml" >
<!-- doesn't work - false positives - Lombok annotations, conflict with Checkstyle -->
<exclude name="UnusedImports" />
<!-- not useful in some cases -->
<exclude name="UseVarargs" />
<!-- conflict with Checkstyle -->
<exclude name="AvoidReassigningParameters" />
<!-- doesn't work -->
<exclude name="GuardLogStatement" />
<!-- low priority -->
<exclude name="AbstractClassWithoutAbstractMethod" />
</rule>
<rule ref="category/java/codestyle.xml" >
<!-- default constructor inherited from Object is OK -->
<exclude name="AtLeastOneConstructor" />
<!-- controversial -->
<exclude name="AvoidFinalLocalVariable" />
<!-- conflict with AvoidFinalLocalVariable check -->
<exclude name="LocalVariableCouldBeFinal" />
<!-- conflict with Checkstyle -->
<exclude name="FormalParameterNamingConventions" />
<!-- controversial -->
<exclude name="CallSuperInConstructor" />
<!-- strongly restricts class naming -->
<exclude name="ClassNamingConventions" />
<!-- controversial -->
<exclude name="ConfusingTernary" />
<!-- doesn't work -->
<exclude name="DefaultPackage" />
<!-- doesn't make sense in some cases -->
<exclude name="EmptyMethodInAbstractClassShouldBeAbstract" />
<!-- conflict with Checkstyle -->
<exclude name="FieldDeclarationsShouldBeAtStartOfClass" />
<!-- conflict with Checkstyle -->
<exclude name="FieldNamingConventions" />
<!-- conflict with Checkstyle -->
<exclude name="GenericsNaming" />
<!-- a longer name is more understandable in some cases -->
<exclude name="LongVariable" />
<!-- controversial -->
<exclude name="MethodArgumentCouldBeFinal" />
<!-- controversial, multiple return statements usually increase readability -->
<exclude name="OnlyOneReturn" />
<!-- doesn't make sense, controversial - example: "public class User" -->
<exclude name="ShortClassName" />
<!-- doesn't make sense, controversial -->
<exclude name="ShortMethodName" />
<!-- doesn't make sense, controversial - example: "id" -->
<exclude name="ShortVariable" />
<!-- low priority -->
<exclude name="UnnecessaryAnnotationValueElement" />
</rule>
<rule ref="category/java/design.xml" >
<!-- low priority -->
<exclude name="AbstractClassWithoutAnyMethod"/>
<!-- conflict with Checkstyle -->
<exclude name="AvoidCatchingGenericException"/>
<!-- controversial -->
<exclude name="DataClass"/>
<!-- conflict with Checkstyle -->
<exclude name="ExcessiveClassLength"/>
<!-- low priority, hard to solve -->
<exclude name="LawOfDemeter"/>
<exclude name="LoosePackageCoupling"/>
<exclude name="GodClass"/>
<exclude name="NcssCount"/>
<exclude name="ExcessiveImports"/>
<exclude name="TooManyFields"/>
<exclude name="TooManyMethods"/>
<!-- conflict with Checkstyle -->
<exclude name="ExcessiveMethodLength"/>
<!-- conflict with Checkstyle -->
<exclude name="ExcessiveParameterList"/>
<!-- low priority -->
<exclude name="ExcessivePublicCount"/>
<!-- conflict with Checkstyle -->
<exclude name="SimplifyBooleanReturns"/>
<!-- doesn't work -->
<exclude name="ImmutableField" />
<!-- conflict with Checkstyle -->
<exclude name="AvoidDeeplyNestedIfStmts"/>
<!-- conflict with Checkstyle -->
<exclude name="UseObjectForClearerAPI"/>
</rule>
<rule ref="category/java/errorprone.xml" >
<!-- OK in some cases -->
<exclude name="AvoidInstanceofChecksInCatchClause" />
<!-- trouble with IOC, Lombok -->
<exclude name="BeanMembersShouldSerialize" />
<!-- false positives -->
<exclude name="DataflowAnomalyAnalysis" />
<exclude name="MissingSerialVersionUID" />
<!-- OK in some cases -->
<exclude name="NullAssignment" />
<!-- no problem with czech language -->
<exclude name="UseLocaleWithCaseConversions" />
<exclude name="CompareObjectsWithEquals" />
<!-- OK in some cases -->
<exclude name="AvoidLiteralsInIfCondition" />
<!-- https://checkstyle.sourceforge.io/config_coding.html#NoClone -->
<exclude name="CloneMethodMustImplementCloneable" />
<exclude name="CloneMethodReturnTypeMustMatchClassName" />
<exclude name="CloneThrowsCloneNotSupportedException" />
</rule>
<rule ref="category/java/multithreading.xml" />
<rule ref="category/java/performance.xml" >
<!-- performance loss is negligible -->
<exclude name="AppendCharacterWithChar" />
<exclude name="SimplifyStartsWith" />
<!-- usually false positives -->
<exclude name="AvoidInstantiatingObjectsInLoops" />
<!-- low priority -->
<exclude name="UseStringBufferForStringAppends" />
</rule>
<rule ref="category/java/security.xml" />
</ruleset>