blob: 8dfe187322523fd7bc9c9ccfe9bc03cada926ef9 [file] [log] [blame]
Yuta HIGUCHIf9808442014-03-20 15:56:50 -07001<?xml version="1.0"?>
2<!DOCTYPE module PUBLIC
Ray Milkey3f5ef562014-03-25 17:11:19 -07003 "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4 "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
Yuta HIGUCHIf9808442014-03-20 15:56:50 -07005
6
7<!--
8
9 Checkstyle configuration that checks the sun coding conventions from:
10
11 - the Java Language Specification at
12 http://java.sun.com/docs/books/jls/second_edition/html/index.html
13
14 - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
15
16 - the Javadoc guidelines at
17 http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
18
19 - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
20
21 - some best practices
22
23 Checkstyle is very configurable. Be sure to read the documentation at
24 http://checkstyle.sf.net (or in your downloaded distribution).
25
26 Most Checks are configurable, be sure to consult the documentation.
27
28 To completely disable a check, just comment it out or delete it from the file.
29
30 Finally, it is worth reading the documentation.
31
32-->
33
Ray Milkeyb5716c52014-04-07 11:38:27 -070034
35<!--
36 The default severity setting in checkstyle is 'error', so some
37 of the rules below are configured to change the severity to
38 'warning'. Over time, these 'warning' settings should be
39 removed as more of the ONOS source code is modified to
40 follow the recommended rules.
41-->
42
43
44
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070045<module name="Checker">
46 <!--
47 If you set the basedir property below, then all reported file
48 names will be relative to the specified directory. See
49 http://checkstyle.sourceforge.net/5.x/config.html#Checker
50
51 <property name="basedir" value="${basedir}"/>
52 -->
53 <!-- Checks that a package-info.java file exists for each package. -->
54 <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
55 <!-- ONOS does not currently supply package level Javadoc information
Ray Milkeyb5716c52014-04-07 11:38:27 -070056 in package-info files -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070057 <!-- <module name="JavadocPackage"/> -->
58
59 <!-- Checks whether files end with a new line. -->
60 <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
Ray Milkeyb5716c52014-04-07 11:38:27 -070061 <module name="NewlineAtEndOfFile">
62 <property name="severity" value="warning"/>
63 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070064
65 <!-- Checks that property files contain the same keys. -->
66 <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
67 <module name="Translation"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -070068
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070069 <!-- Checks for Size Violations. -->
70 <!-- See http://checkstyle.sf.net/config_sizes.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -070071 <module name="FileLength">
72 <property name="severity" value="warning"/>
73 </module>
Ray Milkey3f5ef562014-03-25 17:11:19 -070074
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070075 <!-- Checks for whitespace -->
76 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
77 <module name="FileTabCharacter"/>
78
79 <!-- Miscellaneous other checks. -->
80 <!-- See http://checkstyle.sf.net/config_misc.html -->
81 <module name="RegexpSingleline">
Ray Milkey3f5ef562014-03-25 17:11:19 -070082 <property name="format" value="\s+$"/>
83 <property name="minimum" value="0"/>
84 <property name="maximum" value="0"/>
85 <property name="message" value="Line has trailing spaces."/>
Ray Milkeyb5716c52014-04-07 11:38:27 -070086 <property name="severity" value="warning"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070087 </module>
88
89 <!-- Checks for Headers -->
90 <!-- See http://checkstyle.sf.net/config_header.html -->
91 <!-- <module name="Header"> -->
92 <!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
93 <!-- <property name="fileExtensions" value="java"/> -->
94 <!-- </module> -->
95
96 <module name="TreeWalker">
97
98 <!-- Checks for Javadoc comments. -->
99 <!-- See http://checkstyle.sf.net/config_javadoc.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700100 <module name="JavadocMethod">
101 <property name="severity" value="warning"/>
102 </module>
103 <module name="JavadocType">
104 <property name="severity" value="warning"/>
105 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700106 <module name="JavadocVariable">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700107 <!-- Suppress check for private member Javadocs.
108 Possibly revist fixing these. -->
109 <property name="scope" value="public"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700110 <property name="severity" value="warning"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700111 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700112 <module name="JavadocStyle">
113 <property name="severity" value="warning"/>
114 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700115
116
117 <!-- Checks for Naming Conventions. -->
118 <!-- See http://checkstyle.sf.net/config_naming.html -->
Ray Milkeyec497712014-03-20 17:51:22 -0700119 <module name="ConstantName">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700120 <!-- ONOS allows the name "log" for static final Loggers -->
121 <property name="format"
122 value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700123 <property name="severity" value="warning"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700124 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700125 <module name="LocalFinalVariableName"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700126
Ray Milkeyb5716c52014-04-07 11:38:27 -0700127 <module name="LocalVariableName">
128 <property name="severity" value="warning"/>
129 </module>
130
131 <module name="MemberName">
132 <property name="severity" value="warning"/>
133 </module>
134
135 <module name="MethodName">
136 <property name="severity" value="warning"/>
137 </module>
138
139 <module name="PackageName"/>
140
141 <module name="ParameterName">
142 <property name="severity" value="warning"/>
143 </module>
144
145 <module name="StaticVariableName">
146 <property name="severity" value="warning"/>
147 </module>
148
149 <module name="TypeName"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700150
151 <!-- Checks for imports -->
152 <!-- See http://checkstyle.sf.net/config_import.html -->
153 <module name="AvoidStarImport"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700154 <module name="IllegalImport"/>
155 <!-- defaults to sun.* packages -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700156 <module name="RedundantImport"/>
157 <module name="UnusedImports"/>
158
159
160 <!-- Checks for Size Violations. -->
161 <!-- See http://checkstyle.sf.net/config_sizes.html -->
162 <module name="LineLength">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700163 <!-- ONOS standard usage is 80 columns, but we allow up
164 to 120 to not break the build. -->
165 <property name="max" value="120"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700166 <property name="severity" value="warning"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700167 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700168 <module name="MethodLength">
169 <property name="severity" value="warning"/>
170 </module>
171
172 <module name="ParameterNumber">
173 <property name="severity" value="warning"/>
174 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700175
176
177 <!-- Checks for whitespace -->
178 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700179 <module name="EmptyForIteratorPad">
180 <property name="severity" value="warning"/>
181 </module>
182
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700183 <module name="GenericWhitespace"/>
184 <module name="MethodParamPad"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700185
186 <module name="NoWhitespaceAfter">
187 <property name="severity" value="warning"/>
188 </module>
189
190 <module name="NoWhitespaceBefore">
191 <property name="severity" value="warning"/>
192 </module>
193
Ray Milkey3f5ef562014-03-25 17:11:19 -0700194 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700195 <!-- <module name="OperatorWrap"/> -->
196 <module name="ParenPad"/>
197 <module name="TypecastParenPad"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700198
199 <module name="WhitespaceAfter">
200 <property name="severity" value="warning"/>
201 </module>
202
203 <module name="WhitespaceAround">
204 <property name="severity" value="warning"/>
205 </module>
206
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700207
208
209 <!-- Modifier Checks -->
210 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700211 <module name="ModifierOrder">
212 <property name="severity" value="warning"/>
213 </module>
214
Ray Milkey3f5ef562014-03-25 17:11:19 -0700215 <!-- Disabled for ONOS to allow use of public -->
216 <!-- modifiers in interfaces. -->
217 <!-- <module name="RedundantModifier"/> -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700218
219
220 <!-- Checks for blocks. You know, those {}'s -->
221 <!-- See http://checkstyle.sf.net/config_blocks.html -->
222 <module name="AvoidNestedBlocks">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700223 <!-- ONOS alows declarations inside of switch case blocks -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700224 <property name="allowInSwitchCase" value="true"/>
225 <property name="severity" value="warning"/>
226 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700227 <module name="EmptyBlock">
228 <property name="severity" value="warning"/>
229 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700230
Ray Milkeyb5716c52014-04-07 11:38:27 -0700231 <module name="LeftCurly"/>
232
233 <module name="NeedBraces">
234 <property name="severity" value="warning"/>
235 </module>
236
237 <module name="RightCurly"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700238
239 <!-- Checks for common coding problems -->
240 <!-- See http://checkstyle.sf.net/config_coding.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700241 <!-- ONOS allows conditional operators -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700242 <!-- <module name="AvoidInlineConditionals"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700243 <module name="EmptyStatement">
244 <property name="severity" value="warning"/>
245 </module>
246
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700247 <module name="EqualsHashCode"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700248
249 <module name="HiddenField">
250 <property name="severity" value="warning"/>
251 </module>
252
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700253 <module name="IllegalInstantiation"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700254
255 <module name="InnerAssignment">
256 <property name="severity" value="warning"/>
257 </module>
258
Ray Milkey3f5ef562014-03-25 17:11:19 -0700259 <!-- Many violations of this rule present, revist in a
260 subsequent round of cleanups -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700261 <!-- <module name="MagicNumber"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700262 <module name="MissingSwitchDefault">
263 <property name="severity" value="warning"/>
264 </module>
265
266 <module name="RedundantThrows">
267 <property name="severity" value="warning"/>
268 </module>
269
270 <module name="SimplifyBooleanExpression">
271 <property name="severity" value="warning"/>
272 </module>
273
274 <module name="SimplifyBooleanReturn">
275 <property name="severity" value="warning"/>
276 </module>
277
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700278
279 <!-- Checks for class design -->
280 <!-- See http://checkstyle.sf.net/config_design.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700281 <!-- ONOS produces many warnings of this type.
282 Fixing all of these is outside the scope of the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700283 <!-- <module name="DesignForExtension"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700284 <module name="FinalClass">
285 <property name="severity" value="warning"/>
286 </module>
287
288 <module name="HideUtilityClassConstructor">
289 <property name="severity" value="warning"/>
290 </module>
291
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700292 <module name="InterfaceIsType"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700293
294 <module name="VisibilityModifier">
295 <property name="severity" value="warning"/>
296 </module>
297
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700298
299
300 <!-- Miscellaneous other checks. -->
301 <!-- See http://checkstyle.sf.net/config_misc.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700302 <module name="ArrayTypeStyle">
303 <property name="severity" value="warning"/>
304 </module>
305
Ray Milkey3f5ef562014-03-25 17:11:19 -0700306 <!-- Many violations of this rule currently, too many to fix
307 in the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700308 <!-- <module name="FinalParameters"/> -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700309 <!-- ONOS allows TODO markers in checked in source code -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700310 <!-- <module name="TodoComment"/> -->
311 <module name="UpperEll"/>
312
Ray Milkeyb5716c52014-04-07 11:38:27 -0700313 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700314
Ray Milkeyb5716c52014-04-07 11:38:27 -0700315 </module>