-
Notifications
You must be signed in to change notification settings - Fork 140
/
checkstyle.xml
365 lines (328 loc) · 15.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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="SuppressWarningsFilter"/>
<module name="SeverityMatchFilter">
<property name="severity" value="info"/>
<property name="acceptOnMatch" value="false"/>
</module>
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf"/>
</module>
<module name="TreeWalker">
<property name="severity" value="error"/>
<!-- This only fails if at least 4 spaces have been used somewhere -->
<!-- Generally, this allows to still use the "smart tabs" feature for certain code alignments -->
<module name="RegexpSinglelineJava">
<property name="format" value="^\t* {4,}"/>
<property name="message" value="Indent must use tab characters"/>
<property name="ignoreComments" value="true"/>
</module>
<!-- Needed to suppress warnings if needed -->
<module name="SuppressWarningsHolder"/>
<module name="SuppressWithNearbyCommentFilter"/>
<module name="SuppressionCommentFilter"/>
<!-- Block checks -->
<!-- Nested blocks are allowed -->
<!--
<module name="AvoidNestedBlocks">
<property name="allowInSwitchCase" value="true"/>
</module>
-->
<module name="LeftCurly"/>
<module name="RightCurly"/>
<!-- Class design -->
<module name="DesignForExtension">
<property name="ignoredAnnotations"
value="After, AfterClass, Before, BeforeClass, Test, Override, Provides"/>
</module>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InnerTypeLast"/>
<module name="InterfaceIsType"/>
<module name="MutableException"/>
<module name="OneTopLevelClass"/>
<module name="ThrowsCount"/>
<module name="VisibilityModifier">
<property name="protectedAllowed" value="true"/>
<property name="packageAllowed" value="true"/>
<property name="allowPublicFinalFields" value="true"/>
<property name="allowPublicImmutableFields" value="true"/>
</module>
<!-- Coding -->
<module name="AvoidDoubleBraceInitialization"/>
<module name="AvoidNoArgumentSuperConstructorCall"/>
<module name="CovariantEquals"/>
<module name="DeclarationOrder">
<property name="ignoreModifiers" value="true"/>
<property name="ignoreConstructors" value="true"/>
</module>
<module name="DefaultComesLast"/>
<module name="EmptyStatement"/>
<module name="FallThrough"/>
<module name="IllegalCatch"/>
<module name="IllegalThrows"/>
<module name="IllegalType">
<property name="ignoredMethodNames" value="getInstance"/>
</module>
<module name="IllegalType">
<property name="illegalClassNames" value="org.apache.log4j.Logger,org.slf4j.Logger"/>
<message key="illegal.type" value="Use new Logging API: org.apache.logging.log4j.Logger / LogManager"/>
</module>
<module name="IllegalType">
<property name="illegalClassNames" value="java.util.Random"/>
<message key="illegal.type" value="Use java.util.SplittableRandom for better performance and randomness"/>
</module>
<module name="IllegalType">
<property name="illegalClassNames" value="com.google.inject.Singleton"/>
<message key="illegal.type" value="Use jakarta singleton annotation"/>
</module>
<module name="IllegalType">
<property name="illegalClassNames" value="javax.inject.Singleton,javax.inject.Inject,javax.inject.Provider"/>
<message key="illegal.type" value="Use annotations from jakarta package"/>
</module>
<module name="MultipleVariableDeclarations"/>
<module name="NestedForDepth">
<!-- Very high because some code violates it -->
<property name="max" value="7"/>
</module>
<module name="NestedTryDepth">
<property name="max" value="2"/>
</module>
<module name="NoArrayTrailingComma"/>
<module name="NoClone"/>
<module name="NoEnumTrailingComma"/>
<module name="NoFinalizer"/>
<module name="OneStatementPerLine"/>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="PackageDeclaration"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/>
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/>
<module name="UnnecessarySemicolonInEnumeration"/>
<module name="UnnecessarySemicolonInTryWithResources"/>
<!-- Imports -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<!-- JavaDoc -->
<module name="AtclauseOrder"/>
<module name="InvalidJavadocPosition"/>
<module name="JavadocContentLocationCheck"/>
<module name="JavadocStyle">
<property name="checkEmptyJavadoc" value="true"/>
</module>
<module name="JavadocType">
<property name="scope" value="protected"/>
<property name="allowMissingParamTags" value="true"/>
</module>
<module name="JavadocMethod">
<property name="accessModifiers" value="public, protected"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
</module>
<module name="MissingJavadocMethod">
<property name="scope" value="protected"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="allowedAnnotations" value="Override,Inject,Provides"/>
<!-- Relaxed check on common names -->
<property name="ignoreMethodNamesRegex" value="^(is|get|set|remove|add|new|create|main|run|call).*$"/>
<!-- Don't check constructors -->
<property name="tokens" value="METHOD_DEF,ANNOTATION_FIELD_DEF"/>
</module>
<module name="MissingJavadocType">
<property name="scope" value="public"/>
<property name="skipAnnotations" value="Generated,Command,CommandLine.Command"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<!-- Metrics -->
<module name="JavaNCSS">
<property name="methodMaximum" value="70"/>
<property name="classMaximum" value="800"/>
<property name="fileMaximum" value="1000"/>
</module>
<module name="CyclomaticComplexity">
<property name="switchBlockAsSingleDecisionPoint" value="true"/>
<property name="max" value="20"/>
</module>
<!-- Miscellaneous -->
<module name="ArrayTypeStyle"/>
<module name="AvoidEscapedUnicodeCharacters"/>
<module name="OuterTypeFilename"/>
<module name="TodoComment">
<!-- High priority comments -->
<property name="format" value="(yyyyyy|FIXME)"/>
<message key="todo.match" value="Address this issue or reduce severity"/>
</module>
<module name="UpperEll"/>
<module name="TrailingComment"/>
<module name="Regexp">
<property name="format" value="((System\.(out|err)\.print)|printStackTrace)"/>
<property name="ignoreComments" value="true"/>
<property name="illegalPattern" value="true"/>
<property name="message" value="No printing to console, use a logger."/>
</module>
<!-- Modifier -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- Naming conventions -->
<module name="AbbreviationAsWordInName"/>
<module name="ClassTypeParameterName"/>
<module name="ConstantName">
<!-- Only public constants are checked -->
<property name="applyToProtected" value="false"/>
<property name="applyToPackage" value="false"/>
<property name="applyToPrivate" value="false"/>
</module>
<module name="IllegalIdentifierName"/>
<module name="InterfaceTypeParameterName"/>
<module name="LambdaParameterName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName">
<property name="allowOneCharVarInForLoop" value="true"/>
<!-- Underscores are allowed -->
<property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
</module>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="MethodTypeParameterName"/>
<module name="PackageName"/>
<module name="ParameterName">
<!-- Underscores are allowed -->
<property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
</module>
<module name="RecordComponentName"/>
<module name="RecordTypeParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<!-- Whitespace -->
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoLineWrap"/>
<!--
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
-->
<module name="SingleSpaceSeparator"/>
<module name="WhitespaceAfter"/>
<module name="TypecastParenPad"/>
<module name="EmptyLineSeparator">
<property name="tokens" value="PACKAGE_DEF,CLASS_DEF,INTERFACE_DEF,ENUM_DEF,METHOD_DEF"/>
</module>
<module name="Regexp">
<!-- Trailing whitespaces in comments are allowed -->
<property name="format" value="^(?!(?:[ \t]*?(?:\/?\*\*?|\/\/)[\S \t]+?|[ \t]+$))[\S \t]+[ \t]+$"/>
<property name="illegalPattern" value="true"/>
<property name="message" value="Trailing whitespace"/>
</module>
<!-- This forbids the var keyword, except for constructor, factory methods and in for loops -->
<module name="MatchXpath">
<property name="query"
value="//VARIABLE_DEF[./TYPE/IDENT[@text='var'] and not((./parent::FOR_INIT) or (./parent::FOR_EACH_CLAUSE) or (./ASSIGN/EXPR/LITERAL_NEW) or (./ASSIGN/EXPR/METHOD_CALL/DOT/IDENT[@text='now' or @text='create' or @text='valueOf' or starts-with(@text, 'of') or starts-with(@text, 'new')]) )]" />
<message key="matchxpath.match"
value="The 'var' keyword for local type inference is not allowed, except when using constructors or factory methods" />
</module>
<!-- Extension modules from sevntu.checkstyle -->
<!-- Coding -->
<module name="com.github.sevntu.checkstyle.checks.coding.CustomDeclarationOrderCheck">
<property name="customDeclarationOrder"
value="Field(public static) ### Field(private static) ### Field(public) ### Field(protected) ### Field(private) ### CTOR(.*) ### Method(public static .*) ### Method(.*) ### InnerEnum(.*) ### InnerInterface(.*) ### InnerClass(.*)" />
<property name="caseSensitive" value="true"/>
<property name="fieldPrefix" value=""/>
</module>
<module name="com.github.sevntu.checkstyle.checks.coding.ForbidReturnInFinallyBlockCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.MultipleStringLiteralsExtendedCheck">
<property name="allowedDuplicates" value="7"/>
<property name="ignoreOccurrenceContext" value="ANNOTATION"/>
<property name="ignoreStringsRegexp" value="^""$"/>
<property name="highlightAllDuplicates" value="false"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.coding.ReturnBooleanFromTernaryCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.ForbidCertainImportsCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.AvoidDefaultSerializableInInnerClassesCheck">
<property name="allowPartialImplementation" value="false"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.coding.OverridableMethodInConstructorCheck">
<property name="checkCloneMethod" value="false"/>
<property name="checkReadObjectMethod" value="false"/>
<property name="matchMethodsByArgCount" value="false"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.coding.AvoidHidingCauseExceptionCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.ReturnCountExtendedCheck">
<property name="maxReturnCount" value="4"/>
<property name="ignoreMethodLinesCount" value="20"/>
<property name="minIgnoreReturnDepth" value="4"/>
<property name="ignoreEmptyReturns" value="true"/>
<property name="topLinesToIgnoreCount" value="10"/>
<property name="ignoreMethodsNames" value="equals"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.coding.SimpleAccessorNameNotationCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.UnnecessaryParenthesesExtendedCheck">
<property name="ignoreCalculationOfBooleanVariables" value="false"/>
<property name="ignoreCalculationOfBooleanVariablesWithReturn" value="false"/>
<property name="ignoreCalculationOfBooleanVariablesWithAssert" value="false"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.coding.FinalizeImplementationCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.ForbidThrowAnonymousExceptionsCheck">
<property name="exceptionClassNameRegex" value="^.*Exception"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.coding.MapIterationInForEachLoopCheck">
<property name="proposeValuesUsage" value="true"/>
<property name="proposeKeySetUsage" value="false"/>
<property name="proposeEntrySetUsage" value="false"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.coding.TernaryPerExpressionCountCheck">
<property name="maxTernaryPerExpressionCount" value="1"/>
<property name="ignoreTernaryOperatorsInBraces" value="true"/>
<property name="ignoreIsolatedTernaryOnLine" value="true"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.coding.RedundantReturnCheck">
<property name="allowReturnInEmptyMethodsAndConstructors" value="false"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.coding.DiamondOperatorForVariableDefinitionCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.PreferMethodReferenceCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.EmptyPublicCtorInClassCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.UselessSuperCtorCallCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.UselessSingleCatchCheck"/>
<!-- Design -->
<module name="com.github.sevntu.checkstyle.checks.design.ForbidWildcardAsReturnTypeCheck">
<property name="checkPublicMethods" value="true"/>
<property name="checkPackageMethods" value="true"/>
<property name="checkProtectedMethods" value="true"/>
<property name="checkPrivateMethods" value="false"/>
<property name="checkOverrideMethods" value="false"/>
<property name="checkDeprecatedMethods" value="false"/>
<property name="allowReturnWildcardWithSuper" value="false"/>
<property name="allowReturnWildcardWithExtends" value="false"/>
<property name="returnTypeClassNamesIgnoreRegex" value="^(Comparator|Comparable)$"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.design.NoMainMethodInAbstractClassCheck"/>
<module name="com.github.sevntu.checkstyle.checks.design.PublicReferenceToPrivateTypeCheck"/>
<module name="com.github.sevntu.checkstyle.checks.design.StaticMethodCandidateCheck">
<property name="skippedMethods"
value="readObject, writeObject, readObjectNoData, readResolve, writeReplace"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.design.ConstructorWithoutParamsCheck">
<property name="classNameFormat" value=".*Exception$"/>
<property name="ignoredClassNameFormat" value="UnsupportedOperationException"/>
</module>
<module name="com.github.sevntu.checkstyle.checks.design.InnerClassCheck"/>
<module name="com.github.sevntu.checkstyle.checks.design.HideUtilityClassConstructorCheck"/>
<module name="com.github.sevntu.checkstyle.checks.design.NestedSwitchCheck"/>
<module name="com.github.sevntu.checkstyle.checks.design.AvoidConditionInversionCheck"/>
<module name="com.github.sevntu.checkstyle.checks.design.CauseParameterInExceptionCheck"/>
<module name="com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck"/>
<module name="ForbidCertainMethodCheck">
<property name="methodName" value="assert(True|False)"/>
<property name="argumentCount" value="1"/>
</module>
<module name="ForbidCertainMethodCheck">
<property name="methodName" value="assertEquals"/>
<property name="argumentCount" value="2"/>
</module>
</module>
</module>