-
Notifications
You must be signed in to change notification settings - Fork 136
/
checkstyle.xml
234 lines (204 loc) · 9.59 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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
Checkstyle-Configuration: LinkedIn Style
Description:
LinkedIn Java style.
-->
<module name="Checker">
<property name="severity" value="${checkstyle.severity}" default="error"/>
<module name="TreeWalker">
<module name="FileContentsHolder"/>
<!-- ANNOTATIONS -->
<!-- No trailing empty parenthesis or commas -->
<module name="AnnotationUseStyle">
<property name="elementStyle" value="ignore"/>
</module>
<!-- Ensure @Override is present when {@inheritDoc} Javadoc tag is present
Ignored because it likely causes inconsistent use of @Override (some methods have it while other methods don't)-->
<!-- <module name="MissingOverride"/> -->
<!-- Package level annotations belong in package-info.java -->
<module name="PackageAnnotation"/>
<!-- BLOCKS -->
<!-- Block opening brace on same line -->
<module name="LeftCurly">
<property name="option" value="eol"/>
</module>
<!-- Block closing brace for else, catch, finally on same line -->
<module name="RightCurly">
<property name="option" value="same"/>
</module>
<!-- Always use braces even if optional -->
<module name="NeedBraces"/>
<!-- CLASS DESIGN -->
<!-- Classes containing only static methods should not have a public constructor -->
<!-- ignored due to relatively low signal to noise ratio -->
<!-- <module name="HideUtilityClassConstructor"/> -->
<!-- CODING -->
<!-- Use Java style array declarations (e.g. String[] names), not C style (e.g. String names[]) -->
<module name="ArrayTypeStyle"/>
<!-- If covariant equals defined, standard equals must also be defined -->
<module name="CovariantEquals"/>
<!-- Switch 'default' case must appear last -->
<module name="DefaultComesLast"/>
<!-- Override equals and hashCode together -->
<module name="EqualsHashCode"/>
<!-- No fall through in switch cases, even the last one -->
<module name="FallThrough">
<property name="checkLastCaseGroup" value="true"/>
</module>
<!-- Do not perform assignments embedded within expressions -->
<module name="InnerAssignment"/>
<!-- Switch statements must have a 'default' case -->
<module name="MissingSwitchDefault"/>
<!-- Do not modify the 'for' loop control variable -->
<module name="ModifiedControlVariable"/>
<!-- Each variable declaration must be on a separate line -->
<module name="MultipleVariableDeclarations"/>
<!-- Each statement (i.e. code terminated by a semicolon) must be on a separate line -->
<module name="OneStatementPerLine"/>
<!-- Classes must have an explicit package declaration -->
<module name="PackageDeclaration"/>
<!-- Do not allow references to internal tickets -->
<module name="Regexp">
<property name="format" value="(DDSDBUS|LISAMZA|DATAPIPES)-\d+"/>
<property name="illegalPattern" value="true"/>
<property name="message" value="Referencing internal ticket names is not allowed" />
</module>
<!-- Do not test boolean expressions against the values true or false -->
<module name="SimplifyBooleanExpression"/>
<!-- Do not test for boolean conditions and return the values true or false -->
<module name="SimplifyBooleanReturn"/>
<!-- Do not use '==' to compare string against a literal; use 'equals' -->
<module name="StringLiteralEquality"/>
<!-- Use 'L' with long literals -->
<module name="UpperEll"/>
<!-- IMPORTS -->
<!-- No star imports -->
<module name="AvoidStarImport">
<property name="allowClassImports" value="false"/>
<property name="allowStaticMemberImports" value="false"/>
</module>
<!-- Do not import 'sun' packages -->
<module name="IllegalImport"/>
<!-- Do not duplicate import statements -->
<module name="RedundantImport"/>
<!-- Eliminate unused imports -->
<module name="UnusedImports"/>
<!-- Import ordering -->
<module name="ImportOrder">
<property name="groups" value="/^javax?\./,/^org\./,*,/^com\.linkedin\./" />
<property name="separated" value="true" />
<property name="ordered" value="true"/>
<property name="caseSensitive" value="true" />
<property name="sortStaticImportsAlphabetically" value="true"/>
<property name="option" value="bottom" />
</module>
<!-- JAVADOC COMMENTS -->
<!-- If you have a Javadoc comment, make sure it is properly formed -->
<module name="JavadocStyle">
<property name="checkFirstSentence" value="false"/>
</module>
<module name="JavadocType">
<property name="scope" value="public"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowUndeclaredRTE" value="true"/>
<property name="allowMissingParamTags" value="true"/>
<property name="validateThrows" value="true" />
<property name="allowThrowsTagsForSubclasses" value="true" />
<property name="allowMissingThrowsTags" value="true" />
<property name="allowMissingReturnTag" value="true" />
<property name="allowMissingPropertyJavadoc" value="true" />
<property name="allowedAnnotations" value="Override, AfterMethod, AfterTest, BeforeMethod, BeforeTest, Test" />
</module>
<!-- NAMING CONVENTIONS -->
<!-- Generic parameters for a class must be uppercase letters (e.g. <T>, <OLD>) -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z]+$"/>
</module>
<!-- Constants must be all uppercase letters separated by underscores -->
<module name="ConstantName">
<property name="format" value="^(_?log)|([A-Z][A-Z0-9]*(_[A-Z0-9]+)*)$"/>
</module>
<!-- Local variables must be camel case starting with lowercase letter -->
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<!-- Member variables must be camel case starting with lowercase letter or underscore -->
<module name="MemberName">
<property name="format" value="^[_a-z][a-zA-Z0-9]*$"/>
</module>
<!-- Method name must be camel case starting with a lowercase letter -->
<module name="MethodName"/>
<!-- Generic parameters for a method must be uppercase letters separated by underscore (e.g. <V>, <NEW>) -->
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z]+(_[A-Z]+)*$"/>
</module>
<!-- Package name must be all lowercase letters separated by periods -->
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
</module>
<!-- Parameters must be camel case starting with a lowercase letter -->
<module name="ParameterName"/>
<!-- Static variables must be camel case starting with lowercase letter or underscore -->
<module name="StaticVariableName">
<property name="format" value="^[_a-z][a-zA-Z0-9]*$"/>
</module>
<!-- Type names must be camel case starting with an uppercase letter -->
<module name="TypeName"/>
<!-- LENGTHS -->
<!-- Desired line length is 120 but allow some overrun beyond that -->
<module name="LineLength">
<property name="max" value="160"/>
<message key="maxLineLen" value="Line is longer than {0,number,integer} characters (found {1,number,integer}). Try to keep lines under 120 characters."/>
</module>
<!-- WHITESPACE -->
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<!--
Ignore because it shows a lot of false positives
The code looks cleaner if certain operators remain in the same line
<module name="OperatorWrap"/> -->
<module name="ParenPad"/>
<module name="TypecastParenPad">
<property name="tokens" value="RPAREN,TYPECAST"/>
</module>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<!-- Do not allow meaningless, IDE generated parameter names -->
<module name="RegexpSinglelineJava">
<property name="format" value="[\s]+arg[\d]+[,\)]"/>
<property name="message" value="Replace argN with a meaningful parameter name"/>
</module>
</module>
<!-- Do not allow tab characters in source files -->
<module name="FileTabCharacter"/>
<!-- Ensure parameter and exception names are present on @param and @throws tags -->
<module name="RegexpSingleline">
<property name="format" value="\*[\s]*@(throws|param)[\s]*$"/>
<property name="message" value="Missing parameter or exception name"/>
</module>
<!-- IDE generated code must be reviewed by developer -->
<module name="RegexpSingleline">
<property name="format" value="\/\/[\s]*TODO[\s]+Auto-generated"/>
<property name="message" value="Replace IDE generated code with real implementation"/>
</module>
<!-- Detect commonly misspelled Javadoc tags -->
<module name="RegexpSingleline">
<property name="format" value="\*[\s]*@(params|throw|returns)[\s]+"/>
<property name="message" value="Correct misspelled Javadoc tag"/>
</module>
<!-- Read checker suppressions from a file -->
<module name="SuppressionFilter">
<property name="file" value="checkstyle/suppressions.xml"/>
</module>
<!-- Allow Checkstyle warnings to be suppressed using trailing comments -->
<module name="SuppressWithNearbyCommentFilter"/>
<!-- Allow Checkstyle warnings to be suppressed using block comments -->
<module name="SuppressionCommentFilter"/>
</module>