-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheckstyle.xml
272 lines (230 loc) · 10.4 KB
/
checkstyle.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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="FileLength">
<property name="max" value="500"/>
</module>
<module name="LineLength">
<property name="max" value="80"/>
</module>
<!-- Indentation unit is 4 spaces (tabs are not allowed anywhere.) -->
<module name="RegexpSingleline">
<property name="format" value="\t"/>
<property name="message" value="Line has tabs."/>
</module>
<!-- Break line after a comma. -->
<module name="RegexpSingleline">
<property name="format" value="^\s*,"/>
<property name="message" value="Line has a leading comma."/>
</module>
<!-- Parameter wrapping. -->
<module name="RegexpSingleline">
<property name="format" value="^[^(]*\([^)]+$"/>
<property name="message" value="Opening parenthesis without closing one must be followed by a new line."/>
</module>
<!-- Parameter wrapping. If a parenthesis is opened, either it has to be
closed on the same line, or the line must end immediately.
WARNING - takes very long to process. -->
<!-- <module name="RegexpSingleline">-->
<!-- <property name="format" value="^^(\h*[^()\s\n]+\h*)+\).*$"/>-->
<!-- <property name="message" value="Closing parenthesis without opening one must be on a new line."/>-->
<!-- </module>-->
<!-- Checks whether files end with a new line. -->
<module name="NewlineAtEndOfFile"/>
<!-- Lines should not have trailing spaces. -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="TreeWalker">
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="@checkstyle (\w+) \((\d+) lines\)"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="$2"/>
</module>
<!-- Checks correct indentation. Case clauses in switch statement are
not indented. -->
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="caseIndent" value="0"/>
</module>
<!-- Lines must break before an operator. -->
<module name="OperatorWrap"/>
<!-- Each variable must be declared on a separate line. -->
<module name="MultipleVariableDeclarations"/>
<!-- Local variable or a parameter must not shadow a field that is
defined in the same class. Exceptions: constructor and setter
parameters. -->
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
</module>
<!-- No space between a method name and the parenthesis. -->
<module name="MethodParamPad"/>
<!-- Left curly brace must always be on the end of the line. -->
<module name="LeftCurly"/>
<!-- Right curly brace must start a line. -->
<module name="RightCurly"/>
<!-- Each line must contain at most one statement. -->
<module name="OneStatementPerLine"/>
<!-- Code blocks must have curly braces (if excluded.) -->
<!-- <module name="NeedBraces">-->
<!-- <property name="tokens" value="LITERAL_DO, LITERAL_ELSE, -->
<!-- LITERAL_FOR, LITERAL_WHILE"/>-->
<!-- </module>-->
<!-- All code blocks (including if) must have curly braces. If you are
going to use this configuration, comment out the one above. -->
<module name="NeedBraces"/>
<!-- Checks if unnecessary parentheses are used in a statement or
expression. -->
<module name="UnnecessaryParentheses"/>
<!-- Switch statements must have "default" clause. -->
<module name="MissingSwitchDefault"/>
<!-- default case must be the last one. -->
<module name="DefaultComesLast"/>
<!-- Whitespace checks.
Checks all tokens except RCURLY (right curly brace) because it
conflicts with ParenPad (no parenthesis padding) rule.
Empty method and constructor bodies with curly braces on the same
line don't require a space between them. -->
<module name="WhitespaceAround">
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR,
BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV,
DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT,
LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED,
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD,
MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST,
SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
</module>
<!-- More whitespace checks. -->
<module name="WhitespaceAfter"/>
<!-- Naming conventions. -->
<module name="TypeName"/>
<module name="MethodName">
<!-- <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>-->
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="ConstantName"/>
<!-- Checks visibility of class fields. -->
<!-- Allows private and public (for struct classes.) -->
<module name="VisibilityModifier">
<property name="protectedAllowed" value="false"/>
<property name="publicMemberPattern" value=""/>
</module>
<!-- Subexpressions must not contain assignments, such as in
String s = Integer.toString(i = 2); -->
<module name="InnerAssignment"/>
<!-- Checks for Javadoc comments. -->
<!-- Methods must contain Javadoc. -->
<module name="JavadocMethod"/>
<!-- Types must contain Javadoc. -->
<module name="JavadocType"/>
<!-- Variables must contain Javadoc. -->
<!-- <module name="JavadocVariable"/>-->
<!-- Checks Javadoc style. -->
<module name="JavadocStyle"/>
<!-- Additional naming conventions. -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
</module>
<module name="PackageName"/>
<!-- Checks for imports -->
<!-- Avoid import statements that use the * notation. -->
<module name="AvoidStarImport"/>
<!-- Don't import sun.* packages. -->
<module name="IllegalImport"/>
<!-- Checks for redundant imports. -->
<module name="RedundantImport"/>
<!-- Checks for unused imports. -->
<module name="UnusedImports"/>
<!-- Checks imports order. -->
<module name="ImportOrder">
<property name="option" value="top"/>
<property name="separated" value="false"/>
</module>
<!-- Method signatures must not exceed 7 parameters. -->
<module name="ParameterNumber"/>
<!-- Checks that the whitespace around the Generic tokens < and > is
correct to the typical convention. -->
<module name="GenericWhitespace"/>
<!-- More whitespace checks. -->
<module name="NoWhitespaceAfter"/>
<!-- More whitespace checks. -->
<module name="NoWhitespaceBefore"/>
<!-- Parentheses must not be padded. -->
<module name="ParenPad"/>
<!-- Typecast parentheses must not be padded. -->
<module name="TypecastParenPad"/>
<!-- Checks the order of modifiers (public, abstract, final, etc.) -->
<module name="ModifierOrder"/>
<!-- Checks for redundant modifiers in interface and annotation
definitions. -->
<!-- <module name="RedundantModifier"/>-->
<!-- Code blocks (except catch block) must contain at least one
statement. -->
<!-- <module name="EmptyBlock">-->
<!-- <property name="option" value="stmt"/>-->
<!-- <property name="tokens" value="LITERAL_DO, LITERAL_ELSE,-->
<!-- LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY,-->
<!-- LITERAL_WHILE, INSTANCE_INIT, STATIC_INIT"/>-->
<!-- </module>-->
<!-- Catch blocks must contain at least one statement or comment. -->
<module name="EmptyBlock">
<property name="option" value="text"/>
<property name="tokens" value="LITERAL_CATCH"/>
</module>
<!-- There must be no empty statements (standalone ;'s). -->
<module name="EmptyStatement"/>
<!-- Classes that override equals() must also override hashCode(). -->
<module name="EqualsHashCode"/>
<!-- Classes that define a covariant equals() method must also
override method equals(java.lang.Object). -->
<module name="CovariantEquals"/>
<!-- Boolean must not be instantiated. -->
<module name="IllegalInstantiation">
<property name="classes" value="java.lang.Boolean"/>
</module>
<!-- Checks for overly complicated boolean expressions. -->
<module name="SimplifyBooleanExpression"/>
<!-- Use equals() to compare Strings. -->
<module name="StringLiteralEquality"/>
<!-- Catching java.lang.Exception, java.lang.Error or
java.lang.RuntimeException is almost never acceptable. -->
<module name="IllegalCatch"/>
<!-- Declaring to throw java.lang.Error or java.lang.RuntimeException
is almost never acceptable. -->
<module name="IllegalThrows"/>
<module name="ClassDataAbstractionCoupling"/>
<!-- Checks if any class or object member is explicitly initialized to
default for its type value. -->
<module name="ExplicitInitialization"/>
<!-- Checks for class design -->
<!-- Checks that classes are designed for extension. -->
<module name="DesignForExtension"/>
<!-- Classes which have only private constructors must be declared as
final. -->
<module name="FinalClass"/>
<!-- Interfaces that do not contain any methods but only constants are
inappropriate - an interface should describe a type. -->
<module name="InterfaceIsType"/>
<!-- Miscellaneous other checks. -->
<!-- Arrays must be declared in Java style (not C style.) -->
<module name="ArrayTypeStyle"/>
<!-- long constants must be defined with an uppercase L. -->
<module name="UpperEll"/>
<!-- Make sure package declaration matches directory structure. -->
<module name="PackageDeclaration"/>
</module>
</module>