blob: 9ab4e940d5a734b55a0bf29920d99b0c58e50c30 [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 Milkey0f913a02014-04-07 20:58:17 -070061 <module name="NewlineAtEndOfFile"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070062
63 <!-- Checks that property files contain the same keys. -->
64 <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
65 <module name="Translation"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -070066
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070067 <!-- Checks for Size Violations. -->
68 <!-- See http://checkstyle.sf.net/config_sizes.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -070069 <module name="FileLength">
70 <property name="severity" value="warning"/>
71 </module>
Ray Milkey3f5ef562014-03-25 17:11:19 -070072
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070073 <!-- Checks for whitespace -->
74 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
75 <module name="FileTabCharacter"/>
76
77 <!-- Miscellaneous other checks. -->
78 <!-- See http://checkstyle.sf.net/config_misc.html -->
79 <module name="RegexpSingleline">
Ray Milkey3f5ef562014-03-25 17:11:19 -070080 <property name="format" value="\s+$"/>
81 <property name="minimum" value="0"/>
82 <property name="maximum" value="0"/>
83 <property name="message" value="Line has trailing spaces."/>
Ray Milkeyb5716c52014-04-07 11:38:27 -070084 <property name="severity" value="warning"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070085 </module>
86
87 <!-- Checks for Headers -->
88 <!-- See http://checkstyle.sf.net/config_header.html -->
89 <!-- <module name="Header"> -->
90 <!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
91 <!-- <property name="fileExtensions" value="java"/> -->
92 <!-- </module> -->
93
94 <module name="TreeWalker">
95
96 <!-- Checks for Javadoc comments. -->
97 <!-- See http://checkstyle.sf.net/config_javadoc.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -070098 <module name="JavadocMethod">
99 <property name="severity" value="warning"/>
100 </module>
101 <module name="JavadocType">
102 <property name="severity" value="warning"/>
103 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700104 <module name="JavadocVariable">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700105 <!-- Suppress check for private member Javadocs.
106 Possibly revist fixing these. -->
107 <property name="scope" value="public"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700108 <property name="severity" value="warning"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700109 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700110 <module name="JavadocStyle">
111 <property name="severity" value="warning"/>
112 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700113
114
115 <!-- Checks for Naming Conventions. -->
116 <!-- See http://checkstyle.sf.net/config_naming.html -->
Ray Milkeyec497712014-03-20 17:51:22 -0700117 <module name="ConstantName">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700118 <!-- ONOS allows the name "log" for static final Loggers -->
119 <property name="format"
120 value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700121 <property name="severity" value="warning"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700122 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700123 <module name="LocalFinalVariableName"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700124
Ray Milkeyb5716c52014-04-07 11:38:27 -0700125 <module name="LocalVariableName">
126 <property name="severity" value="warning"/>
127 </module>
128
129 <module name="MemberName">
130 <property name="severity" value="warning"/>
131 </module>
132
133 <module name="MethodName">
134 <property name="severity" value="warning"/>
135 </module>
136
137 <module name="PackageName"/>
138
139 <module name="ParameterName">
140 <property name="severity" value="warning"/>
141 </module>
142
143 <module name="StaticVariableName">
144 <property name="severity" value="warning"/>
145 </module>
146
147 <module name="TypeName"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700148
149 <!-- Checks for imports -->
150 <!-- See http://checkstyle.sf.net/config_import.html -->
151 <module name="AvoidStarImport"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700152 <module name="IllegalImport"/>
153 <!-- defaults to sun.* packages -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700154 <module name="RedundantImport"/>
155 <module name="UnusedImports"/>
156
157
158 <!-- Checks for Size Violations. -->
159 <!-- See http://checkstyle.sf.net/config_sizes.html -->
160 <module name="LineLength">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700161 <!-- ONOS standard usage is 80 columns, but we allow up
162 to 120 to not break the build. -->
163 <property name="max" value="120"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700164 <property name="severity" value="warning"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700165 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700166 <module name="MethodLength">
167 <property name="severity" value="warning"/>
168 </module>
169
170 <module name="ParameterNumber">
171 <property name="severity" value="warning"/>
172 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700173
174
175 <!-- Checks for whitespace -->
176 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700177 <module name="EmptyForIteratorPad">
178 <property name="severity" value="warning"/>
179 </module>
180
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700181 <module name="GenericWhitespace"/>
182 <module name="MethodParamPad"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700183
184 <module name="NoWhitespaceAfter">
185 <property name="severity" value="warning"/>
186 </module>
187
188 <module name="NoWhitespaceBefore">
189 <property name="severity" value="warning"/>
190 </module>
191
Ray Milkey3f5ef562014-03-25 17:11:19 -0700192 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700193 <!-- <module name="OperatorWrap"/> -->
194 <module name="ParenPad"/>
195 <module name="TypecastParenPad"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700196
197 <module name="WhitespaceAfter">
198 <property name="severity" value="warning"/>
199 </module>
200
201 <module name="WhitespaceAround">
202 <property name="severity" value="warning"/>
203 </module>
204
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700205
206
207 <!-- Modifier Checks -->
208 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700209 <module name="ModifierOrder">
210 <property name="severity" value="warning"/>
211 </module>
212
Ray Milkey3f5ef562014-03-25 17:11:19 -0700213 <!-- Disabled for ONOS to allow use of public -->
214 <!-- modifiers in interfaces. -->
215 <!-- <module name="RedundantModifier"/> -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700216
217
218 <!-- Checks for blocks. You know, those {}'s -->
219 <!-- See http://checkstyle.sf.net/config_blocks.html -->
220 <module name="AvoidNestedBlocks">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700221 <!-- ONOS alows declarations inside of switch case blocks -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700222 <property name="allowInSwitchCase" value="true"/>
223 <property name="severity" value="warning"/>
224 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700225 <module name="EmptyBlock">
226 <property name="severity" value="warning"/>
227 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700228
Ray Milkeyb5716c52014-04-07 11:38:27 -0700229 <module name="LeftCurly"/>
230
231 <module name="NeedBraces">
232 <property name="severity" value="warning"/>
233 </module>
234
235 <module name="RightCurly"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700236
237 <!-- Checks for common coding problems -->
238 <!-- See http://checkstyle.sf.net/config_coding.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700239 <!-- ONOS allows conditional operators -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700240 <!-- <module name="AvoidInlineConditionals"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700241 <module name="EmptyStatement">
242 <property name="severity" value="warning"/>
243 </module>
244
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700245 <module name="EqualsHashCode"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700246
247 <module name="HiddenField">
248 <property name="severity" value="warning"/>
249 </module>
250
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700251 <module name="IllegalInstantiation"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700252
253 <module name="InnerAssignment">
254 <property name="severity" value="warning"/>
255 </module>
256
Ray Milkey3f5ef562014-03-25 17:11:19 -0700257 <!-- Many violations of this rule present, revist in a
258 subsequent round of cleanups -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700259 <!-- <module name="MagicNumber"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700260 <module name="MissingSwitchDefault">
261 <property name="severity" value="warning"/>
262 </module>
263
264 <module name="RedundantThrows">
265 <property name="severity" value="warning"/>
266 </module>
267
268 <module name="SimplifyBooleanExpression">
269 <property name="severity" value="warning"/>
270 </module>
271
272 <module name="SimplifyBooleanReturn">
273 <property name="severity" value="warning"/>
274 </module>
275
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700276
277 <!-- Checks for class design -->
278 <!-- See http://checkstyle.sf.net/config_design.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700279 <!-- ONOS produces many warnings of this type.
280 Fixing all of these is outside the scope of the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700281 <!-- <module name="DesignForExtension"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700282 <module name="FinalClass">
283 <property name="severity" value="warning"/>
284 </module>
285
286 <module name="HideUtilityClassConstructor">
287 <property name="severity" value="warning"/>
288 </module>
289
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700290 <module name="InterfaceIsType"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700291
292 <module name="VisibilityModifier">
293 <property name="severity" value="warning"/>
294 </module>
295
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700296
297
298 <!-- Miscellaneous other checks. -->
299 <!-- See http://checkstyle.sf.net/config_misc.html -->
Ray Milkey45614c52014-04-07 16:30:54 -0700300 <module name="ArrayTypeStyle"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700301
Ray Milkey3f5ef562014-03-25 17:11:19 -0700302 <!-- Many violations of this rule currently, too many to fix
303 in the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700304 <!-- <module name="FinalParameters"/> -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700305 <!-- ONOS allows TODO markers in checked in source code -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700306 <!-- <module name="TodoComment"/> -->
307 <module name="UpperEll"/>
308
Ray Milkeyb5716c52014-04-07 11:38:27 -0700309 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700310
Ray Milkeyb5716c52014-04-07 11:38:27 -0700311 </module>