-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcheckstyle.xml
333 lines (314 loc) · 17.5 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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- Checks for Size Violations -->
<!-- See http://checkstyle.sourceforge.net/config_sizes.html -->
<!-- ************************** -->
<module name="LineLength">
<property name="severity" value="warning"/>
<property name="max" value="150"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>
<!-- Configures filter to suppress audit events for annotations -->
<!-- See https://checkstyle.sourceforge.io/config_filters.html#SuppressionFilter -->
<module name="SuppressWarningsFilter" />
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile">
<property name="fileExtensions" value="java,gradle,xml,txt,prefab"/>
</module>
<!-- Checks that there are no tab characters ('\t') in the source code. -->
<!-- See http://checkstyle.sourceforge.net/config_whitespace.html#FileTabCharacter -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
<property name="fileExtensions" value="java"/>
</module>
<!-- Checks for header -->
<!-- See http://checkstyle.sourceforge.net/config_header.html -->
<!-- ***************** -->
<!-- Checks that a source file begins with a specified header. -->
<module name="RegexpHeader">
<property name="severity" value="warning"/>
<property name="header" value="// Copyright 20\d\d The Terasology Foundation\n// SPDX-License-Identifier: Apache-2.0"/>
<property name="fileExtensions" value="java"/>
</module>
<!-- Disallow author names and auto-generated tags -->
<!--
TODO: replace with proper JavaDoc checks as soon as they work properly.
See https://github.com/checkstyle/checkstyle/issues/952
See https://github.com/checkstyle/checkstyle/issues/2506
-->
<module name="RegexpSingleline">
<property name="severity" value="warning"/>
<property name="format" value="^\s*\*\s*@author"/>
<property name="fileExtensions" value="java"/>
<property name="message" value="Author tags are not allowed"/>
</module>
<!-- Disallow empty JavaDoc -->
<module name="RegexpMultiline">
<property name="severity" value="warning" />
<property name="format" value="(\/\*\*)(\s|\*)*(\*\/)" />
<property name="fileExtensions" value="java" />
<property name="message" value="Empty JavaDoc" />
</module>
<module name="TreeWalker">
<!-- Makes the annotations available to the filter. -->
<module name="SuppressWarningsHolder" />
<!-- Checks for Naming Conventions -->
<!-- See http://checkstyle.sourceforge.net/config_naming.html -->
<!-- ***************************** -->
<!-- class type parameters : ^[A-Z]*$ -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z]*$"/>
</module>
<!-- constants (static, final fields) : ^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$ -->
<!-- Unfortunately this module is too inclusive - static final fields are not necessarily constants! -->
<module name="ConstantName">
<property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|logger)$"/>
<property name="severity" value="info"/>
</module>
<!-- local, final variables, including catch parameters : ^[a-z][a-zA-Z0-9]*$ -->
<module name="LocalFinalVariableName"/>
<!-- local, non-final variables, including catch parameters : ^[a-z][a-zA-Z0-9]*$ -->
<module name="LocalVariableName"/>
<!-- non-static fields : ^[a-z][a-zA-Z0-9]*$ -->
<module name="MemberName"/>
<!-- methods : ^[a-z][a-zA-Z0-9]*$ -->
<module name="MethodName"/>
<!-- method type parameters : ^[A-Z]*$ -->
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z]*$"/>
</module>
<!-- packages : ^[a-z]+(\.[a-zA-Z_][a-zA-Z0-9_]*)*$ -->
<module name="PackageName"/>
<!-- parameters : ^[a-z][a-zA-Z0-9]*$ -->
<module name="ParameterName"/>
<!-- static, non-final fields : ^[a-z][a-zA-Z0-9]*$ -->
<module name="StaticVariableName"/>
<!-- classes and interfaces : ^[A-Z][a-zA-Z0-9]*$ -->
<module name="TypeName"/>
<!-- Checks for imports -->
<!-- See http://checkstyle.sourceforge.net/config_imports.html -->
<!-- ****************** -->
<!-- Checks that there are no import statements that use the * notation. -->
<!-- See http://checkstyle.sourceforge.net/config_imports.html#AvoidStarImport -->
<module name="AvoidStarImport">
<property name="severity" value="warning"/>
<!-- allow starred static member imports -->
<property name="allowStaticMemberImports" value="true"/>
<property name="excludes" value="java.awt,javax.swing"/>
</module>
<!-- Checks for redundant import statements. -->
<!-- See http://checkstyle.sourceforge.net/config_imports.html#RedundantImport -->
<module name="RedundantImport">
<property name="severity" value="warning"/>
</module>
<!-- Checks for unused import statements. -->
<!-- See http://checkstyle.sourceforge.net/config_imports.html#UnusedImports -->
<module name="UnusedImports">
<property name="severity" value="warning"/>
</module>
<!-- Checks for banned packages, sun.* by default. -->
<!-- See http://checkstyle.sourceforge.net/config_imports.html#IllegalImport -->
<module name="IllegalImport"/>
<!-- Checks for the number of types declared at the outer (or root) level in a file. -->
<module name="OuterTypeNumber"/>
<!-- Checks for whitespaces -->
<!-- See http://checkstyle.sourceforge.net/config_whitespace.html -->
<!-- ********************** -->
<!-- Checks the padding of an empty for iterator; that is whether a space is required at an empty for iterator, or such spaces are forbidden. -->
<module name="EmptyForIteratorPad">
<property name="severity" value="warning"/>
</module>
<!-- Checks the padding between the identifier of a method definition, constructor definition, method call, or constructor invocation; and the left parenthesis of the parameter list. -->
<module name="MethodParamPad">
<property name="severity" value="warning"/>
</module>
<!-- Checks that there is no whitespace after a token. -->
<module name="NoWhitespaceAfter">
<property name="severity" value="warning"/>
</module>
<!-- Checks that there is no whitespace before a token. -->
<module name="NoWhitespaceBefore">
<property name="severity" value="warning"/>
</module>
<!-- Checks line wrapping for operators. -->
<module name="OperatorWrap">
<property name="severity" value="warning"/>
<property name="tokens" value="BAND,BOR,BSR,BXOR,COLON,DIV,EQUAL,GE,GT,LAND,LE,LITERAL_INSTANCEOF,LOR,LT,MINUS,MOD,NOT_EQUAL,QUESTION,SL,SR,STAR"/>
</module>
<!-- Checks that the whitespace around the Generic tokens < and > is correct to the typical convention. -->
<module name="GenericWhitespace">
<property name="severity" value="warning"/>
</module>
<!-- Checks the policy on the padding of parentheses. -->
<module name="ParenPad">
<property name="severity" value="warning"/>
</module>
<!-- Checks the policy on the padding of parentheses for typecasts. -->
<module name="TypecastParenPad">
<property name="severity" value="warning"/>
</module>
<!-- Checks that a token is followed by whitespace. -->
<module name="WhitespaceAfter">
<property name="severity" value="warning"/>
</module>
<!-- Checks that a token is surrounded by whitespace. -->
<module name="WhitespaceAround">
<property name="severity" value="warning"/>
<!-- We skip RCURLY because a false positive when it appears in annotations -->
<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_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"/>
</module>
<!-- Modifier Checks -->
<!-- See http://checkstyle.sourceforge.net/config_modifier.html -->
<!-- *************** -->
<!-- Checks that the order of modifiers conforms to the suggestions in the Java Language specification -->
<!-- See http://checkstyle.sourceforge.net/config_modifier.html#ModifierOrder -->
<module name="ModifierOrder"/>
<!-- Checks for redundant modifiers -->
<!-- See http://checkstyle.sourceforge.net/config_modifier.html#RedundantModifier -->
<module name="RedundantModifier">
<property name="severity" value="warning"/>
</module>
<!-- Checks for blocks -->
<!-- See http://checkstyle.sourceforge.net/config_blocks.html -->
<!-- *************************************** -->
<!-- Finds nested blocks, i.e. blocks that are used freely in the code. -->
<!-- See http://checkstyle.sourceforge.net/config_blocks.html#AvoidNestedBlocks -->
<module name="AvoidNestedBlocks">
<property name="severity" value="warning"/>
<property name="allowInSwitchCase" value="true"/>
</module>
<!-- Checks for empty blocks. -->
<!-- See http://checkstyle.sourceforge.net/config_blocks.html#EmptyBlock -->
<module name="EmptyBlock">
<property name="severity" value="warning"/>
</module>
<!-- Checks for the placement of left curly braces ('{') for code blocks. Default: eol -->
<!-- See http://checkstyle.sourceforge.net/config_blocks.html#LeftCurly -->
<module name="LeftCurly"/>
<!-- Checks for braces around code blocks. -->
<!-- See http://checkstyle.sourceforge.net/config_blocks.html#NeedBraces -->
<module name="NeedBraces"/>
<!-- Checks the placement of right curly braces ('}') for else, try, and catch tokens. Default: same -->
<!-- See http://checkstyle.sourceforge.net/config_blocks.html#RightCurly -->
<module name="RightCurly"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sourceforge.net/config_coding.html -->
<!-- ********************************* -->
<!-- Checks that classes that define a covariant equals() method also override method equals(java.lang.Object). -->
<module name="CovariantEquals"/>
<!-- Detects empty statements (standalone ;). -->
<module name="EmptyStatement"/>
<!-- Checks that classes that override equals() also override hashCode(). -->
<module name="EqualsHashCode"/>
<!-- Checks for assignments in subexpressions. -->
<module name="InnerAssignment"/>
<!-- Check for ensuring that for loop control variables are not modified inside the for block. -->
<module name="ModifiedControlVariable"/>
<!-- Checks for overly complicated boolean expressions. -->
<module name="SimplifyBooleanExpression">
<property name="severity" value="warning"/>
</module>
<!-- Checks for overly complicated boolean return statements. -->
<module name="SimplifyBooleanReturn">
<property name="severity" value="warning"/>
</module>
<!-- Checks that string literals are not used with == or !=. -->
<module name="StringLiteralEquality"/>
<!-- This check can be used to ensure that types are not declared to be thrown. Declaring to throw java.lang.Error or java.lang.RuntimeException is almost never acceptable. -->
<module name="IllegalThrows">
<property name="severity" value="warning"/>
</module>
<!-- Ensure a class is has a package declaration, and (optionally) whether the package name matches the directory name for the source file. -->
<module name="PackageDeclaration"/>
<!-- Checks that particular class are never used as types in variable declarations, return values or parameters. Includes a pattern check that by default disallows abstract classes. -->
<module name="IllegalType">
<property name="severity" value="warning"/>
</module>
<!-- Checks for the order of the parts of a class. -->
<module name="DeclarationOrder">
<property name="severity" value="warning"/>
</module>
<!-- Disallow assignment of parameters. -->
<module name="ParameterAssignment"/>
<!-- Checks if any class or object member explicitly initialized to default for its type value. -->
<module name="ExplicitInitialization">
<property name="severity" value="ignore"/> <!-- 'ignore' because we often want to be explicit about initializations and belive the performance penalty is negligible -->
</module>
<!-- Check that the default is after all the cases in a switch statement. -->
<module name="DefaultComesLast"/>
<!-- Checks for fall through in switch statements Finds locations where a case contains Java code - but lacks a break, return, throw or continue statement. -->
<module name="FallThrough"/>
<!-- Checks that each variable declaration is in its own statement and on its own line. -->
<module name="MultipleVariableDeclarations"/>
<!-- Checks there is only one statement per line. -->
<module name="OneStatementPerLine"/>
<!-- Checks for class design -->
<!-- See http://checkstyle.sourceforge.net/config_design.html -->
<!-- *********************** -->
<!-- Checks visibility of class members. Only static final members may be public. -->
<!--
<module name="VisibilityModifier">
<property name="severity" value="warning"/>
</module>
-->
<!-- Checks that a class which has only private constructors is declared as final. -->
<module name="FinalClass">
<property name="severity" value="warning"/>
</module>
<!-- Make sure that utility classes (classes that contain only static methods or fields in their API) do not have a public constructor. -->
<module name="HideUtilityClassConstructor">
<property name="severity" value="warning"/>
</module>
<!-- Use Interfaces only to define types. -->
<module name="InterfaceIsType">
<property name="severity" value="warning"/>
</module>
<!-- Ensures that exceptions are immutable. -->
<module name="MutableException"/>
<!-- Check nested (internal) classes/interfaces are declared at the bottom of the class after all method and field declarations. -->
<module name="InnerTypeLast">
<property name="severity" value="info"/>
</module>
<!-- Miscellaneous other checks -->
<!-- See http://checkstyle.sourceforge.net/config_misc.html -->
<!-- *************************** -->
<!-- Checks the style of array type definitions. -->
<!-- See http://checkstyle.sourceforge.net/config_misc.html#ArrayTypeStyle -->
<module name="ArrayTypeStyle">
<property name="severity" value="warning"/>
</module>
<!-- Checks correct indentation of Java Code. -->
<!-- See http://checkstyle.sourceforge.net/config_misc.html#Indentation -->
<!-- Disabled because it is buggy + unreasonable -->
<!--<module name="Indentation">
<property name="severity" value="info"/>
</module>-->
<!-- Checks that long constants are defined with an upper ell. That is ' L' and not 'l'. -->
<!-- See http://checkstyle.sourceforge.net/config_misc.html#UpperEll -->
<module name="UpperEll"/>
<!-- Checks that the outer type name and the file name match. -->
<!-- See http://checkstyle.sourceforge.net/config_misc.html#OuterTypeFilename -->
<module name="OuterTypeFilename"/>
<!-- Checks for annotations -->
<!-- See http://checkstyle.sourceforge.net/config_annotation.html -->
<!-- ********************** -->
<!-- This check controls the style with the usage of annotations. -->
<module name="AnnotationUseStyle">
<property name="severity" value="warning"/>
</module>
<!-- Verifies that both the java.lang.Deprecated annotation is present and the @deprecated Javadoc tag is present when either is present. -->
<module name="MissingDeprecated">
<property name="severity" value="warning"/>
</module>
<!-- Verifies that the java.lang.Override annotation is present when the {@inheritDoc} javadoc tag is present. -->
<module name="MissingOverride">
<property name="severity" value="warning"/>
</module>
</module>
</module>