-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprod.ruleset.xml
More file actions
156 lines (143 loc) · 6.35 KB
/
Copy pathprod.ruleset.xml
File metadata and controls
156 lines (143 loc) · 6.35 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?xml version="1.0"?>
<ruleset name="emu-prod-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 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>Emu ruleset for production code</description>
<rule ref="category/java/bestpractices.xml">
<!-- Avoid reporting custom logger calls -->
<exclude name="GuardLogStatement" />
</rule>
<rule ref="category/java/codestyle.xml">
<!-- Avoid reporting variables with a short name -->
<exclude name="ShortVariable" />
<!-- Avoid reporting methods with a short name -->
<exclude name="ShortMethodName" />
<!-- Avoid reporting classes with a short name -->
<exclude name="ShortClassName" />
<!-- Avoid reporting methods with early exits -->
<exclude name="OnlyOneReturn" />
<!-- Avoid reporting default constructors -->
<exclude name="UnnecessaryConstructor" />
<!-- Avoid reporting class names not declared in camel case -->
<exclude name="ClassNamingConventions" />
<!-- Avoid reporting field name not declared in camel case -->
<exclude name="FieldNamingConventions" />
<!-- Avoid reporting method names not declared in camel case -->
<exclude name="MethodNamingConventions" />
<!-- Avoid reporting variables not declared in camel case -->
<exclude name="LocalVariableNamingConventions" />
<!-- Avoid reporting method/lambda parameters not declared in camel case -->
<exclude name="FormalParameterNamingConventions" />
</rule>
<!-- Avoid reporting variables with a long name -->
<rule ref="category/java/codestyle.xml/LongVariable">
<properties>
<property name="minimum" value="45" />
</properties>
</rule>
<!-- Avoid reporting if-else with a != condition -->
<rule ref="category/java/codestyle.xml/ConfusingTernary">
<properties>
<property name="ignoreElseIf" value="true" />
</properties>
</rule>
<!-- Avoid reporting files with too many static imports (FIXME: workaround until [this issue](https://github.com/pmd/pmd/issues/6983) gets fixed in PMD) -->
<rule ref="category/java/codestyle.xml/TooManyStaticImports">
<properties>
<property name="maximumStaticImports" value="10" />
</properties>
</rule>
<rule ref="category/java/design.xml">
<!-- Avoid reporting classes with too many imports -->
<exclude name="ExcessiveImports" />
<!-- Avoid reporting classes with too many methods -->
<exclude name="GodClass" />
<!-- Avoid reporting classes with too little functionality -->
<exclude name="DataClass" />
<!-- Avoid reporting usage of classes from outside the package hierarchy -->
<exclude name="LoosePackageCoupling" />
<!-- Rules excluded to be configured later in this file -->
<exclude name="TooManyFields" />
<exclude name="TooManyMethods" />
<exclude name="CyclomaticComplexity" />
<exclude name="NPathComplexity" />
<exclude name="NcssCount" />
<exclude name="ExcessivePublicCount" />
</rule>
<!-- Avoid reporting classes with too many fields -->
<rule ref="category/java/design.xml/TooManyFields">
<properties>
<property name="maxfields" value="15" />
</properties>
</rule>
<!-- Avoid reporting classes with too many methods -->
<rule ref="category/java/design.xml/TooManyMethods">
<properties>
<property name="maxmethods" value="30" />
</properties>
</rule>
<!-- Avoid reporting methods that are "too complex" -->
<rule ref="category/java/design.xml/CyclomaticComplexity">
<properties>
<property name="classReportLevel" value="80" />
<property name="methodReportLevel" value="35" />
<property name="cycloOptions" value="" />
</properties>
</rule>
<!-- Avoid reporting methods that are "too complex" -->
<rule ref="category/java/design.xml/NPathComplexity">
<properties>
<property name="reportLevel" value="100" />
</properties>
</rule>
<!-- Avoid reporting methods that are "too complex" -->
<rule ref="category/java/design.xml/CognitiveComplexity">
<properties>
<property name="reportLevel" value="70" />
</properties>
</rule>
<!-- Avoid reporting classes with "too many lines" -->
<rule ref="category/java/design.xml/NcssCount">
<properties>
<property name="methodReportLevel" value="100" />
<property name="classReportLevel" value="1500" />
<property name="ncssOptions" value="" />
</properties>
</rule>
<!-- Avoid retrieving data from "too far away" -->
<rule ref="category/java/design.xml/LawOfDemeter">
<properties>
<property name="trustRadius" value="3" />
</properties>
</rule>
<!-- Avoid reporting classes with too many public fields and methods -->
<rule ref="category/java/design.xml/ExcessivePublicCount">
<properties>
<property name="minimum" value="45" />
</properties>
</rule>
<rule ref="category/java/documentation.xml">
<!-- Avoid reporting comments with too many lines -->
<exclude name="CommentSize" />
<!-- Avoid reporting missing comments on private fields -->
<exclude name="CommentRequired" />
<!-- Avoid reporting constructors with empty body -->
<exclude name="UncommentedEmptyConstructor" />
</rule>
<rule ref="category/java/errorprone.xml">
<!-- Avoid reporting System.exit() -->
<exclude name="DoNotTerminateVM" />
<!-- Avoid reporting methods with the same name of fields -->
<exclude name="AvoidFieldNameMatchingMethodName" />
</rule>
<rule ref="category/java/multithreading.xml">
<!-- Avoid reporting anything related to java.lang.Thread or Executors -->
<exclude name="DoNotUseThreads" />
</rule>
<rule ref="category/java/performance.xml">
<!-- Avoid reporting redundant field initialization -->
<exclude name="RedundantFieldInitializer" />
</rule>
<rule ref="category/java/security.xml" />
</ruleset>