1
+ <!--
2
+ Copied from https://github.com/checkstyle/checkstyle/blob/33304206fb5b2f10c832cbc2e9d5d373280f6d9d/src/main/resources/google_checks.xml
3
+ As of: 7/10/20
4
+ -->
5
+ <?xml version =" 1.0" ?>
6
+ <!DOCTYPE module PUBLIC
7
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
8
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
9
+
10
+ <!--
11
+ Checkstyle configuration that checks the Google coding conventions from Google Java Style
12
+ that can be found at https://google.github.io/styleguide/javaguide.html
13
+ Checkstyle is very configurable. Be sure to read the documentation at
14
+ http://checkstyle.org (or in your downloaded distribution).
15
+ To completely disable a check, just comment it out or delete it from the file.
16
+ To suppress certain violations please review suppression filters.
17
+ Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
18
+ -->
19
+
20
+ <module name = " Checker" >
21
+ <!-- Modification: Tab width is 4 spaces-->
22
+ <property name =" tabWidth" value =" 4" />
23
+
24
+ <property name =" charset" value =" UTF-8" />
25
+
26
+ <property name =" severity" value =" warning" />
27
+
28
+ <property name =" fileExtensions" value =" java, properties, xml" />
29
+ <!-- Excludes all 'module-info.java' files -->
30
+ <!-- See https://checkstyle.org/config_filefilters.html -->
31
+ <module name =" BeforeExecutionExclusionFileFilter" >
32
+ <property name =" fileNamePattern" value =" module\-info\.java$" />
33
+ </module >
34
+ <!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
35
+ <module name =" SuppressionFilter" >
36
+ <property name =" file" value =" ${org.checkstyle.google.suppressionfilter.config}"
37
+ default =" checkstyle-suppressions.xml" />
38
+ <property name =" optional" value =" true" />
39
+ </module >
40
+
41
+ <!-- Checks for whitespace -->
42
+ <!-- See http://checkstyle.org/config_whitespace.html -->
43
+ <module name =" FileTabCharacter" >
44
+ <property name =" eachLine" value =" true" />
45
+ </module >
46
+
47
+ <module name =" LineLength" >
48
+ <property name =" fileExtensions" value =" java" />
49
+ <property name =" max" value =" 100" />
50
+ <property name =" ignorePattern" value =" ^package.*|^import.*|a href|href|http://|https://|ftp://" />
51
+ </module >
52
+
53
+ <module name =" TreeWalker" >
54
+ <module name =" OuterTypeFilename" />
55
+ <module name =" IllegalTokenText" >
56
+ <property name =" tokens" value =" STRING_LITERAL, CHAR_LITERAL" />
57
+ <property name =" format"
58
+ value =" \\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)" />
59
+ <property name =" message"
60
+ value =" Consider using special escape sequence instead of octal value or Unicode escaped value." />
61
+ </module >
62
+ <module name =" AvoidEscapedUnicodeCharacters" >
63
+ <property name =" allowEscapesForControlCharacters" value =" true" />
64
+ <property name =" allowByTailComment" value =" true" />
65
+ <property name =" allowNonPrintableEscapes" value =" true" />
66
+ </module >
67
+ <module name =" AvoidStarImport" />
68
+ <module name =" OneTopLevelClass" />
69
+ <module name =" NoLineWrap" >
70
+ <property name =" tokens" value =" PACKAGE_DEF, IMPORT, STATIC_IMPORT" />
71
+ </module >
72
+ <module name =" EmptyBlock" >
73
+ <property name =" option" value =" TEXT" />
74
+ <property name =" tokens"
75
+ value =" LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH" />
76
+ </module >
77
+ <module name =" NeedBraces" >
78
+ <property name =" tokens"
79
+ value =" LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE" />
80
+ </module >
81
+ <module name =" LeftCurly" >
82
+ <property name =" tokens"
83
+ value =" ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
84
+ INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
85
+ LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
86
+ LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
87
+ OBJBLOCK, STATIC_INIT" />
88
+ </module >
89
+ <module name =" RightCurly" >
90
+ <property name =" id" value =" RightCurlySame" />
91
+ <property name =" tokens"
92
+ value =" LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
93
+ LITERAL_DO" />
94
+ </module >
95
+ <module name =" RightCurly" >
96
+ <property name =" id" value =" RightCurlyAlone" />
97
+ <property name =" option" value =" alone" />
98
+ <property name =" tokens"
99
+ value =" CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
100
+ INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, INTERFACE_DEF" />
101
+ </module >
102
+ <module name =" SuppressionXpathSingleFilter" >
103
+ <!-- suppresion is required till https://github.com/checkstyle/checkstyle/issues/7541 -->
104
+ <property name =" id" value =" RightCurlyAlone" />
105
+ <property name =" query" value =" //RCURLY[parent::SLIST[count(./*)=1]
106
+ or preceding-sibling::*[last()][self::LCURLY]]" />
107
+ </module >
108
+ <module name =" WhitespaceAfter" >
109
+ <property name =" tokens"
110
+ value =" COMMA, SEMI, TYPECAST, LITERAL_IF, LITERAL_ELSE,
111
+ LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, DO_WHILE" />
112
+ </module >
113
+ <module name =" WhitespaceAround" >
114
+ <property name =" allowEmptyConstructors" value =" true" />
115
+ <property name =" allowEmptyLambdas" value =" true" />
116
+ <property name =" allowEmptyMethods" value =" true" />
117
+ <property name =" allowEmptyTypes" value =" true" />
118
+ <property name =" allowEmptyLoops" value =" true" />
119
+ <property name =" tokens"
120
+ value =" ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
121
+ BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND,
122
+ LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
123
+ LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
124
+ LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
125
+ NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
126
+ SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND" />
127
+ <message key =" ws.notFollowed"
128
+ value =" WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)" />
129
+ <message key =" ws.notPreceded"
130
+ value =" WhitespaceAround: ''{0}'' is not preceded with whitespace." />
131
+ </module >
132
+ <module name =" OneStatementPerLine" />
133
+ <module name =" MultipleVariableDeclarations" />
134
+ <module name =" ArrayTypeStyle" />
135
+ <module name =" MissingSwitchDefault" />
136
+ <module name =" FallThrough" />
137
+ <module name =" UpperEll" />
138
+ <module name =" ModifierOrder" />
139
+ <module name =" EmptyLineSeparator" >
140
+ <property name =" tokens"
141
+ value =" PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
142
+ STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF" />
143
+ <property name =" allowNoEmptyLineBetweenFields" value =" true" />
144
+ </module >
145
+ <module name =" SeparatorWrap" >
146
+ <property name =" id" value =" SeparatorWrapDot" />
147
+ <property name =" tokens" value =" DOT" />
148
+ <property name =" option" value =" nl" />
149
+ </module >
150
+ <module name =" SeparatorWrap" >
151
+ <property name =" id" value =" SeparatorWrapComma" />
152
+ <property name =" tokens" value =" COMMA" />
153
+ <property name =" option" value =" EOL" />
154
+ </module >
155
+ <module name =" SeparatorWrap" >
156
+ <!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 -->
157
+ <property name =" id" value =" SeparatorWrapEllipsis" />
158
+ <property name =" tokens" value =" ELLIPSIS" />
159
+ <property name =" option" value =" EOL" />
160
+ </module >
161
+ <module name =" SeparatorWrap" >
162
+ <!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 -->
163
+ <property name =" id" value =" SeparatorWrapArrayDeclarator" />
164
+ <property name =" tokens" value =" ARRAY_DECLARATOR" />
165
+ <property name =" option" value =" EOL" />
166
+ </module >
167
+ <module name =" SeparatorWrap" >
168
+ <property name =" id" value =" SeparatorWrapMethodRef" />
169
+ <property name =" tokens" value =" METHOD_REF" />
170
+ <property name =" option" value =" nl" />
171
+ </module >
172
+ <module name =" PackageName" >
173
+ <property name =" format" value =" ^[a-z]+(\.[a-z][a-z0-9]*)*$" />
174
+ <message key =" name.invalidPattern"
175
+ value =" Package name ''{0}'' must match pattern ''{1}''." />
176
+ </module >
177
+ <module name =" TypeName" >
178
+ <property name =" tokens" value =" CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF" />
179
+ <message key =" name.invalidPattern"
180
+ value =" Type name ''{0}'' must match pattern ''{1}''." />
181
+ </module >
182
+ <module name =" MemberName" >
183
+ <property name =" format" value =" ^[a-z][a-z0-9][a-zA-Z0-9]*$" />
184
+ <message key =" name.invalidPattern"
185
+ value =" Member name ''{0}'' must match pattern ''{1}''." />
186
+ </module >
187
+ <module name =" ParameterName" >
188
+ <property name =" format" value =" ^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
189
+ <message key =" name.invalidPattern"
190
+ value =" Parameter name ''{0}'' must match pattern ''{1}''." />
191
+ </module >
192
+ <module name =" LambdaParameterName" >
193
+ <property name =" format" value =" ^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
194
+ <message key =" name.invalidPattern"
195
+ value =" Lambda parameter name ''{0}'' must match pattern ''{1}''." />
196
+ </module >
197
+ <module name =" CatchParameterName" >
198
+ <property name =" format" value =" ^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
199
+ <message key =" name.invalidPattern"
200
+ value =" Catch parameter name ''{0}'' must match pattern ''{1}''." />
201
+ </module >
202
+ <module name =" LocalVariableName" >
203
+ <property name =" format" value =" ^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
204
+ <message key =" name.invalidPattern"
205
+ value =" Local variable name ''{0}'' must match pattern ''{1}''." />
206
+ </module >
207
+ <module name =" ClassTypeParameterName" >
208
+ <property name =" format" value =" (^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" />
209
+ <message key =" name.invalidPattern"
210
+ value =" Class type name ''{0}'' must match pattern ''{1}''." />
211
+ </module >
212
+ <module name =" MethodTypeParameterName" >
213
+ <property name =" format" value =" (^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" />
214
+ <message key =" name.invalidPattern"
215
+ value =" Method type name ''{0}'' must match pattern ''{1}''." />
216
+ </module >
217
+ <module name =" InterfaceTypeParameterName" >
218
+ <property name =" format" value =" (^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" />
219
+ <message key =" name.invalidPattern"
220
+ value =" Interface type name ''{0}'' must match pattern ''{1}''." />
221
+ </module >
222
+ <module name =" NoFinalizer" />
223
+ <module name =" GenericWhitespace" >
224
+ <message key =" ws.followed"
225
+ value =" GenericWhitespace ''{0}'' is followed by whitespace." />
226
+ <message key =" ws.preceded"
227
+ value =" GenericWhitespace ''{0}'' is preceded with whitespace." />
228
+ <message key =" ws.illegalFollow"
229
+ value =" GenericWhitespace ''{0}'' should followed by whitespace." />
230
+ <message key =" ws.notPreceded"
231
+ value =" GenericWhitespace ''{0}'' is not preceded with whitespace." />
232
+ </module >
233
+ <module name =" Indentation" >
234
+ <property name =" basicOffset" value =" 2" />
235
+ <property name =" braceAdjustment" value =" 0" />
236
+ <property name =" caseIndent" value =" 2" />
237
+ <property name =" throwsIndent" value =" 4" />
238
+ <property name =" lineWrappingIndentation" value =" 4" />
239
+ <property name =" arrayInitIndent" value =" 2" />
240
+ </module >
241
+ <module name =" AbbreviationAsWordInName" >
242
+ <property name =" ignoreFinal" value =" false" />
243
+ <property name =" allowedAbbreviationLength" value =" 1" />
244
+ <property name =" tokens"
245
+ value =" CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
246
+ PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF, PATTERN_VARIABLE_DEF" />
247
+ </module >
248
+ <module name =" OverloadMethodsDeclarationOrder" />
249
+ <module name =" VariableDeclarationUsageDistance" />
250
+ <module name =" CustomImportOrder" >
251
+ <property name =" sortImportsInGroupAlphabetically" value =" true" />
252
+ <property name =" separateLineBetweenGroups" value =" true" />
253
+ <property name =" customImportOrderRules" value =" STATIC###THIRD_PARTY_PACKAGE" />
254
+ <property name =" tokens" value =" IMPORT, STATIC_IMPORT, PACKAGE_DEF" />
255
+ </module >
256
+ <module name =" MethodParamPad" >
257
+ <property name =" tokens"
258
+ value =" CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
259
+ SUPER_CTOR_CALL, ENUM_CONSTANT_DEF" />
260
+ </module >
261
+ <module name =" NoWhitespaceBefore" >
262
+ <property name =" tokens"
263
+ value =" COMMA, SEMI, POST_INC, POST_DEC, DOT,
264
+ LABELED_STAT, METHOD_REF" />
265
+ <property name =" allowLineBreaks" value =" true" />
266
+ </module >
267
+ <module name =" ParenPad" >
268
+ <property name =" tokens"
269
+ value =" ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, ENUM_CONSTANT_DEF,
270
+ EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW,
271
+ LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL,
272
+ METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA" />
273
+ </module >
274
+ <module name =" OperatorWrap" >
275
+ <property name =" option" value =" NL" />
276
+ <property name =" tokens"
277
+ value =" BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
278
+ LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF " />
279
+ </module >
280
+ <module name =" AnnotationLocation" >
281
+ <property name =" id" value =" AnnotationLocationMostCases" />
282
+ <property name =" tokens"
283
+ value =" CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF" />
284
+ </module >
285
+ <module name =" AnnotationLocation" >
286
+ <property name =" id" value =" AnnotationLocationVariables" />
287
+ <property name =" tokens" value =" VARIABLE_DEF" />
288
+ <property name =" allowSamelineMultipleAnnotations" value =" true" />
289
+ </module >
290
+ <module name =" NonEmptyAtclauseDescription" />
291
+ <module name =" InvalidJavadocPosition" />
292
+ <module name =" JavadocTagContinuationIndentation" />
293
+ <module name =" SummaryJavadoc" >
294
+ <property name =" forbiddenSummaryFragments"
295
+ value =" ^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )" />
296
+ </module >
297
+ <module name =" JavadocParagraph" />
298
+ <module name =" AtclauseOrder" >
299
+ <property name =" tagOrder" value =" @param, @return, @throws, @deprecated" />
300
+ <property name =" target"
301
+ value =" CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF" />
302
+ </module >
303
+ <module name =" JavadocMethod" >
304
+ <property name =" scope" value =" public" />
305
+ <property name =" allowMissingParamTags" value =" true" />
306
+ <property name =" allowMissingReturnTag" value =" true" />
307
+ <property name =" allowedAnnotations" value =" Override, Test" />
308
+ <property name =" tokens" value =" METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF" />
309
+ </module >
310
+ <module name =" MissingJavadocMethod" >
311
+ <property name =" scope" value =" public" />
312
+ <property name =" minLineCount" value =" 2" />
313
+ <property name =" allowedAnnotations" value =" Override, Test" />
314
+ <!-- Modification: main method doesn't need JavaDoc-->
315
+ <property name =" ignoreMethodNamesRegex" value =" main" />
316
+ <property name =" tokens" value =" METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF" />
317
+ </module >
318
+ <module name =" MethodName" >
319
+ <property name =" format" value =" ^[a-z][a-z0-9][a-zA-Z0-9_]*$" />
320
+ <message key =" name.invalidPattern"
321
+ value =" Method name ''{0}'' must match pattern ''{1}''." />
322
+ </module >
323
+ <module name =" SingleLineJavadoc" >
324
+ <property name =" ignoreInlineTags" value =" false" />
325
+ </module >
326
+ <module name =" EmptyCatchBlock" >
327
+ <property name =" exceptionVariableName" value =" expected" />
328
+ </module >
329
+ <module name =" CommentsIndentation" >
330
+ <property name =" tokens" value =" SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN" />
331
+ </module >
332
+ <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
333
+ <module name =" SuppressionXpathFilter" >
334
+ <property name =" file" value =" ${org.checkstyle.google.suppressionxpathfilter.config}"
335
+ default =" checkstyle-xpath-suppressions.xml" />
336
+ <property name =" optional" value =" true" />
337
+ </module >
338
+ </module >
339
+ </module >
0 commit comments