forked from DRSchlaubi/discordstats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coding_style.xml
337 lines (297 loc) · 15 KB
/
coding_style.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
<?xml version="1.0"?>
<!--
=================================================================================================
Copyright 2011 Twitter, Inc.
_________________________________________________________________________________________________
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this work except in compliance with the License.
You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=================================================================================================
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the sun coding conventions from:
- the Java Language Specification at
http://java.sun.com/docs/books/jls/second_edition/html/index.html
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
- the Javadoc guidelines at
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
- some best practices
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
Most Checks are configurable, be sure to consult the documentation.
To completely disable a check, just comment it out or delete it from the file.
Finally, it is worth reading the documentation.
-->
<module name="Checker">
<!--
If you set the basedir property below, then all reported file
names will be relative to the specified directory. See
http://checkstyle.sourceforge.net/config.html#Checker
<property name="basedir" value="${basedir}"/>
-->
<!-- TODO(John Sirois): Eliminate the strange `__shaded_by_pants__` package prefixes for
twitter custom checks from this configuration when this issue is fixed:
https://github.com/pantsbuild/pants/issues/1906
-->
<!-- We use this to turn off specific checks for specific file types.
-->
<module name="__shaded_by_pants__.com.twitter.common.checkstyle.SplitSuppressionFilter">
<property name="files" value="${checkstyle.suppression.files}"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE\:OFF ([\w\|]+)"/>
<property name="onCommentFormat" value="CHECKSTYLE\:ON ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
</module>
<!-- allow suppression (via comments) of a specified check +/- 1 line from
a in-code comment "// SUPPRESS CHECKSTYLE CheckNameHere"
C style comments are allowed as well
-->
<module name="SuppressWithNearbyCommentFilter">
<property name="influenceFormat" value="1"/>
</module>
<!-- now again for one line before the comment -->
<module name="SuppressWithNearbyCommentFilter">
<property name="influenceFormat" value="-1"/>
</module>
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>
<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter"/>
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="TreeWalker">
<property name="tabWidth" value="2"/>
<!-- needed for SuppressWithNearbyCommentFilter -->
<module name="FileContentsHolder"/>
<!-- Annotations -->
<module name="AnnotationUseStyle"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride"/>
<module name="PackageAnnotation"/>
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="__shaded_by_pants__.com.twitter.common.checkstyle.JavadocMethodRegexCheck">
<!-- don't require javadoc for methods shorter than or equal to
this many lines (including opening & closing brace lines)
-->
<property name="minLineCount" value="5"/>
<!-- javadoc doesn't need one @param, @return, @throws tags -->
<property name="scope" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<!-- simple set/get methods don't need javadoc comments -->
<property name="allowMissingPropertyJavadoc" value="true" />
<!-- Allow tags for runtime exceptions that are not explicitly declared -->
<property name="allowUndeclaredRTE" value="true" />
</module>
<module name="JavadocType">
<property name="excludeScope" value="private"/>
</module>
<module name="JavadocStyle">
<property name="checkFirstSentence" value="false"/>
<property name="checkEmptyJavadoc" value="true"/>
</module>
<!-- Checks for Naming Conventions. -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z][A-Z0-9]?$"/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z][A-Z0-9]?$"/>
</module>
<module name="ConstantName"/>
<module name="LocalFinalVariableName">
<!-- allow VAR_NAME and varName in local final variables,
leave it up to user to use them appropriately depending on whether
or not the variable is A_CONSTANT_VARIBLE, or aMutableVariable.
-->
<property name="format" value="^(([a-z][a-zA-Z0-9]*)|([A-Z][A-Z0-9]*(_[A-Z0-9]+)*))$" />
</module>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="__shaded_by_pants__.com.twitter.common.checkstyle.NonOverriddenMethodName">
<property name="format" value="^(([a-z][a-zA-Z0-9]*)|(\$tag))$" />
</module>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<!-- Following interprets the header file as regular expressions. -->
<!-- <module name="RegexpHeader"/> -->
<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport">
<property name="excludes" value="org.junit.Assert"/>
<property name="excludes" value="java.util.*"/>
</module>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="ImportOrder">
<property name="groups"
value="/^javax?\./,scala,com,net,org,com.twitter"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="bottom"/>
<message key="import.ordering"
value="Wrong order for ''{0}'' import. Order should be: java, javax, scala, com, net, org,
com.twitter. Each group should be separated by a single blank line." />
</module>
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="LineLength">
<property name="max" value="100"/>
<!-- Ignore import statements and javadoc comments -->
<property name="ignorePattern" value="^import.*$|^ *\*( |[^/]) *.*$"/>
</module>
<module name="OuterTypeNumber"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<!-- Intentionally excludes RCURLY (default) since it trips on anonymous
inner class declarations when chained with a method call.
-->
<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"/>
</module>
<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock">
<!-- Allow comments to satisfy the EmptyBlock check -->
<property name="option" value="text"/>
</module>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<module name="CovariantEquals"/>
<module name="EmptyStatement"/>
<module name="EqualsAvoidNull"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
</module>
<!-- Checks for catch of overly general exception classes like
RuntimeException, Exception, Throwable, etc. -->
<module name="IllegalCatch"/>
<!-- disallow calling constructors on these classes
calling factories is the only way to create these objects
-->
<module name="IllegalInstantiation">
<property name="classes" value="java.lang.Boolean"/>
</module>
<module name="IllegalToken">
<property name="tokens" value="LITERAL_NATIVE"/>
</module>
<!-- TODO(John Sirois): Modify this rule to pass on enhanced try statements
in java7 like it does for for loops -->
<!-- <module name="InnerAssignment"/> -->
<module name="MissingSwitchDefault"/>
<module name="ModifiedControlVariable"/>
<module name="RedundantThrows">
<property name="allowUnchecked" value="true"/>
<!-- Need to set to true, else we get lots of errors:
"Unable to get class information for ThriftException -->
<property name="suppressLoadErrors" value="true"/>
<message key="redundant.throws.duplicate"
value="Redundant throws: {0} listed more than one time. This
will trigger spuriously if checkstyle can''t resolve {0} on its classpath." />
<message key="redundant.throws.subclass"
value="Redundant throws: {0} is a subclass of {1}. This
will trigger spuriously if checkstyle can''t resolve either class on its
classpath." />
</module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="NestedForDepth">
<property name="max" value="2"/>
</module>
<module name="NestedTryDepth">
<property name="max" value="1"/>
</module>
<module name="NoClone"/>
<module name="NoFinalizer"/>
<module name="SuperClone"/>
<module name="SuperFinalize"/>
<!-- disallow throws Throwable unless a superclass or interface requires this -->
<module name="__shaded_by_pants__.com.twitter.common.checkstyle.IllegalThrowsCheck"/>
<module name="PackageDeclaration">
<property name="ignoreDirectoryName" value="true"/>
</module>
<module name="JUnitTestCase"/>
<module name="ParameterAssignment"/>
<module name="DefaultComesLast"/>
<module name="FallThrough"/>
<module name="MultipleVariableDeclarations"/>
<module name="UnnecessaryParentheses"/>
<module name="OneStatementPerLine"/>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="protectedAllowed" value="true"/>
<!-- Allow public members at the coder's discretion, for struct-like things. -->
<property name="publicMemberPattern" value="^.*$" />
</module>
<module name="MutableException"/>
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
<module name="ArrayTypeStyle"/>
<module name="OuterTypeFilename"/>
<!-- Regexp checks -->
<module name="RegexpSinglelineJava">
<property name="format" value="System.exit"/>
<property name="ignoreComments" value="true"/>
<property name="message"
value="Don't System.exit(), throw a RuntimeException()" />
</module>
</module>
</module>