-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pmd.ruleset.xml
120 lines (112 loc) · 5.13 KB
/
.pmd.ruleset.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
<?xml version="1.0"?>
<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.io/ruleset_2_0_0.xsd">
<description>
Custom rules used for conformance suite java
</description>
<rule ref="category/java/multithreading.xml">
<!-- UseConcurrentHashMap is quite noisy, and PMD developers don't necessarily recommend
using it - https://github.com/pmd/pmd/issues/1022#issuecomment-378687539 -->
<exclude name="UseConcurrentHashMap"/>
<!-- The use of Runnable in FutureWatcher seems to trigger DoNotUseThreads -->
<exclude name="DoNotUseThreads"/>
<!-- "Use block level rather than method level
synchronization." is triggered by TestRunner /
TestInstanceEventLog -->
<exclude name="AvoidSynchronizedAtMethodLevel"/>
<!-- AbstractTestModule getStatus uses volatile, see
https://gitlab.com/openid/conformance-suite/-/merge_requests/888#note_317415222
Do be careful about using volatile elsewhere as per
https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.3.1.4 -->
<exclude name="AvoidUsingVolatile"/>
</rule>
<rule ref="category/java/documentation.xml/CommentContent"
message="Please don't use the @author annotation, reliable authorship information can already be found in git">
<properties>
<property name="disallowedTerms" value="@author"/>
</properties>
</rule>
<rule ref="category/java/errorprone.xml">
<!-- AbstractCondition triggers this for not closing BasicHttpClientConnectionManager. It doesn't appear to
be vital to close it. -->
<exclude name="CloseResource"/>
<!-- We do this in a few places, some of which look very intentional. -->
<exclude name="ReturnEmptyCollectionRatherThanNull"/>
<!-- These are excluded just because the codebase, at the time PMD was added, raised a number of these
warnings. No analysis has been done on whether they're good checks to exclude. -->
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="DataflowAnomalyAnalysis"/>
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="NullAssignment"/>
<exclude name="EmptyIfStmt"/>
<exclude name="AvoidInstanceofChecksInCatchClause"/>
<exclude name="UseLocaleWithCaseConversions"/>
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="EmptyCatchBlock"/>
<exclude name="NonStaticInitializer"/>
</rule>
<rule ref="category/java/codestyle.xml">
<!-- These are excluded mainly because the codebase, at the time this ruleset was added, raised a number of these
warnings. No indepth analysis was done. -->
<exclude name="MethodArgumentCouldBeFinal"/>
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="LongVariable"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="ShortVariable"/>
<exclude name="ShortClassName"/>
<exclude name="OnlyOneReturn"/>
<exclude name="UnnecessaryLocalBeforeReturn"/>
<exclude name="PrematureDeclaration"/>
<exclude name="ShortMethodName"/>
<exclude name="UnnecessaryAnnotationValueElement"/>
<exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
<exclude name="FieldNamingConventions"/>
<exclude name="LinguisticNaming"/>
<exclude name="UnnecessaryModifier"/>
<exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
<exclude name="UselessParentheses"/>
<exclude name="AtLeastOneConstructor"/>
<exclude name="ConfusingTernary"/>
<exclude name="LocalVariableNamingConventions"/>
<exclude name="CallSuperInConstructor"/>
<exclude name="ClassNamingConventions"/>
<exclude name="UseUnderscoresInNumericLiterals"/>
</rule>
<rule ref="category/java/bestpractices.xml">
<exclude name="GuardLogStatement"/>
<exclude name="LiteralsFirstInComparisons"/>
<exclude name="ConstantsInInterface"/>
<exclude name="UnusedAssignment"/>
<exclude name="PreserveStackTrace"/>
<exclude name="ReplaceHashtableWithMap"/>
<exclude name="AvoidUsingHardCodedIP"/>
<exclude name="MethodReturnsInternalArray"/>
<exclude name="ReplaceVectorWithList"/>
<exclude name="AvoidReassigningParameters"/>
<exclude name="UseTryWithResources"/>
<exclude name="DoubleBraceInitialization"/>
<exclude name="SwitchStmtsShouldHaveDefault"/>
<!-- a potentially useful rule, but triggers loads of false positives as we have many real classes that have
'Test' in their name, and isn't configurable enough -->
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
</rule>
<!--
We should probably enable more rules one day
<rule ref="category/java/design.xml"></rule>
<rule ref="category/java/documentation.xml"></rule>
<rule ref="category/java/performance.xml"></rule>
<rule ref="category/java/security.xml"></rule>
-->
<!-- https://stackoverflow.com/a/48679770/292166
Avoid flagging private @PostConstruct methods as unused
-->
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod">
<properties>
<property name="violationSuppressXPath"
value="ancestor::ClassOrInterfaceBodyDeclaration/Annotation/MarkerAnnotation/Name[@Image='PostConstruct']" />
</properties>
</rule>
</ruleset>