-
-
Notifications
You must be signed in to change notification settings - Fork 764
Expand file tree
/
Copy pathpmd.xml
More file actions
133 lines (117 loc) · 5.7 KB
/
pmd.xml
File metadata and controls
133 lines (117 loc) · 5.7 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Base ruleset" 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 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
General Java quality rules.
</description>
<!-- Best practices (https://pmd.github.io/pmd-6.0.1/pmd_rules_java_bestpractices.html) -->
<rule ref="category/java/bestpractices.xml">
<exclude name="AbstractClassWithoutAbstractMethod"/>
<!-- disabled as it's important for android and doesn't matter for general java (also fixes will
conflict with checkstyle's VisibilityModifier check -->
<exclude name="AccessorMethodGeneration"/>
<exclude name="ArrayIsStoredDirectly"/>
<exclude name="GuardLogStatement"/>
<!-- Doesn't work with Java 8 switch clause -->
<exclude name="ExhaustiveSwitchHasDefault"/>
<exclude name="EnumComparison"/>
</rule>
<!-- Code style (https://pmd.github.io/pmd-6.0.1/pmd_rules_java_codestyle.html) -->
<rule ref="category/java/codestyle.xml">
<exclude name="AtLeastOneConstructor"/>
<exclude name="CallSuperInConstructor"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="ConfusingTernary"/>
<exclude name="GenericsNaming"/>
<exclude name="LinguisticNaming"/>
<exclude name="LocalHomeNamingConvention"/> <!-- earlier j2ee group-->
<exclude name="LocalInterfaceSessionNamingConvention"/> <!-- earlier j2ee group-->
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="LongVariable"/>
<exclude name="MDBAndSessionBeanNamingConvention"/> <!-- earlier j2ee group-->
<exclude name="OnlyOneReturn"/> <!-- disabled in favour of checkstyle ReturnCount check -->
<exclude name="RemoteInterfaceNamingConvention"/> <!-- earlier j2ee group-->
<exclude name="RemoteSessionInterfaceNamingConvention"/> <!-- earlier j2ee group-->
<exclude name="ShortClassName"/>
<exclude name="ShortMethodName"/>
<exclude name="ShortVariable"/>
<exclude name="TooManyStaticImports"/>
<exclude name="UnnecessaryAnnotationValueElement"/>
<exclude name="UseDiamondOperator"/>
<exclude name="UselessParentheses"/>
</rule>
<rule ref="category/java/codestyle.xml/ClassNamingConventions">
<properties>
<property name="utilityClassPattern" value="[A-Z][a-zA-Z0-9]+"/>
</properties>
</rule>
<!-- Design (https://pmd.github.io/pmd-6.0.1/pmd_rules_java_design.html) -->
<rule ref="category/java/design.xml">
<exclude name="AvoidCatchingGenericException"/>
<exclude name="CouplingBetweenObjects"/>
<exclude name="DataClass"/>
<exclude name="ExcessiveImports"/>
<exclude name="LawOfDemeter"/>
<exclude name="CyclomaticComplexity"/> <!-- disabled in favour of checkstyle's CyclomaticComplexity check -->
<exclude name="LoosePackageCoupling"/>
<exclude name="SignatureDeclareThrowsException"/>
<exclude name="TooManyFields"/>
</rule>
<rule ref="category/java/design.xml/AvoidDeeplyNestedIfStmts">
<properties>
<property name="problemDepth" value="4"/>
</properties>
</rule>
<rule ref="category/java/design.xml/NcssCount">
<properties>
<property name="methodReportLevel" value="30"/>
<property name="classReportLevel" value="300"/>
</properties>
</rule>
<rule ref="category/java/design.xml/NPathComplexity">
<properties>
<property name="reportLevel" value="201"/>
</properties>
</rule>
<rule ref="category/java/design.xml/TooManyMethods" message="Avoid classes longer than 20 methods">
<properties>
<property name="maxmethods" value="20"/>
</properties>
</rule>
<!-- Documentation (https://pmd.github.io/pmd-6.0.1/pmd_rules_java_documentation.html) -->
<rule ref="category/java/documentation.xml">
<exclude name="CommentRequired"/>
<exclude name="CommentSize"/>
</rule>
<!-- Error prone (https://pmd.github.io/pmd-6.0.1/pmd_rules_java_errorprone.html) -->
<rule ref="category/java/errorprone.xml">
<exclude name="AvoidCatchingThrowable"/>
<exclude name="AvoidCatchingGenericException"/>
<exclude name="AvoidDuplicateLiterals"/> <!-- duplicate of checkstyle check MultipleStringLiterals -->
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AssignmentInOperand"/> <!-- duplicate of checkstyle check AssignmentInOperand -->
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="EmptyFinalizer"/>
<exclude name="FinalizeDoesNotCallSuperFinalize"/>
<exclude name="FinalizeOnlyCallsSuperFinalize"/>
<exclude name="JUnitSpelling"/>
<exclude name="JUnitStaticSuite"/>
<exclude name="MissingSerialVersionUID"/>
<exclude name="NullAssignment"/> <!-- disabled due to false positive for initialization with ternary operator -->
<exclude name="StaticEJBFieldShouldBeFinal"/> <!-- earlier j2ee group-->
<exclude name="TestClassWithoutTestCases"/>
<exclude name="UseCorrectExceptionLogging"/>
<exclude name="UseLocaleWithCaseConversions"/>
<exclude name="UseProperClassLoader"/> <!-- earlier j2ee group-->
</rule>
<!-- Error prone (https://pmd.github.io/pmd-6.0.1/pmd_rules_java_multithreading.html) -->
<rule ref="category/java/multithreading.xml">
<exclude name="DoNotUseThreads"/> <!-- earlier j2ee group-->
<exclude name="UseConcurrentHashMap"/>
</rule>
<!-- Performance (https://pmd.github.io/pmd-6.0.1/pmd_rules_java_performance.html) -->
<rule ref="category/java/performance.xml"/>
<!-- Security (no rules) -->
<rule ref="category/java/security.xml"/>
</ruleset>