blob: 975350ea74c1cdb9ed9d8dbebd64edfe8653bc39 [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 Milkey2476cac2014-04-08 11:03:21 -0700125 <module name="LocalVariableName"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700126
Ray Milkey2476cac2014-04-08 11:03:21 -0700127 <module name="MemberName"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700128
129 <module name="MethodName">
130 <property name="severity" value="warning"/>
131 </module>
132
133 <module name="PackageName"/>
134
135 <module name="ParameterName">
136 <property name="severity" value="warning"/>
137 </module>
138
139 <module name="StaticVariableName">
140 <property name="severity" value="warning"/>
141 </module>
142
143 <module name="TypeName"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700144
145 <!-- Checks for imports -->
146 <!-- See http://checkstyle.sf.net/config_import.html -->
147 <module name="AvoidStarImport"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700148 <module name="IllegalImport"/>
149 <!-- defaults to sun.* packages -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700150 <module name="RedundantImport"/>
151 <module name="UnusedImports"/>
152
153
154 <!-- Checks for Size Violations. -->
155 <!-- See http://checkstyle.sf.net/config_sizes.html -->
156 <module name="LineLength">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700157 <!-- ONOS standard usage is 80 columns, but we allow up
158 to 120 to not break the build. -->
159 <property name="max" value="120"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700160 <property name="severity" value="warning"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700161 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700162 <module name="MethodLength">
163 <property name="severity" value="warning"/>
164 </module>
165
166 <module name="ParameterNumber">
167 <property name="severity" value="warning"/>
168 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700169
170
171 <!-- Checks for whitespace -->
172 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700173 <module name="EmptyForIteratorPad">
174 <property name="severity" value="warning"/>
175 </module>
176
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700177 <module name="GenericWhitespace"/>
178 <module name="MethodParamPad"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700179
180 <module name="NoWhitespaceAfter">
181 <property name="severity" value="warning"/>
182 </module>
183
184 <module name="NoWhitespaceBefore">
185 <property name="severity" value="warning"/>
186 </module>
187
Ray Milkey3f5ef562014-03-25 17:11:19 -0700188 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700189 <!-- <module name="OperatorWrap"/> -->
190 <module name="ParenPad"/>
191 <module name="TypecastParenPad"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700192
193 <module name="WhitespaceAfter">
194 <property name="severity" value="warning"/>
195 </module>
196
197 <module name="WhitespaceAround">
198 <property name="severity" value="warning"/>
199 </module>
200
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700201
202
203 <!-- Modifier Checks -->
204 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700205 <module name="ModifierOrder">
206 <property name="severity" value="warning"/>
207 </module>
208
Ray Milkey3f5ef562014-03-25 17:11:19 -0700209 <!-- Disabled for ONOS to allow use of public -->
210 <!-- modifiers in interfaces. -->
211 <!-- <module name="RedundantModifier"/> -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700212
213
214 <!-- Checks for blocks. You know, those {}'s -->
215 <!-- See http://checkstyle.sf.net/config_blocks.html -->
216 <module name="AvoidNestedBlocks">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700217 <!-- ONOS alows declarations inside of switch case blocks -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700218 <property name="allowInSwitchCase" value="true"/>
219 <property name="severity" value="warning"/>
220 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700221 <module name="EmptyBlock">
222 <property name="severity" value="warning"/>
223 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700224
Ray Milkeyb5716c52014-04-07 11:38:27 -0700225 <module name="LeftCurly"/>
226
227 <module name="NeedBraces">
228 <property name="severity" value="warning"/>
229 </module>
230
231 <module name="RightCurly"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700232
233 <!-- Checks for common coding problems -->
234 <!-- See http://checkstyle.sf.net/config_coding.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700235 <!-- ONOS allows conditional operators -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700236 <!-- <module name="AvoidInlineConditionals"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700237 <module name="EmptyStatement">
238 <property name="severity" value="warning"/>
239 </module>
240
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700241 <module name="EqualsHashCode"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700242
243 <module name="HiddenField">
244 <property name="severity" value="warning"/>
245 </module>
246
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700247 <module name="IllegalInstantiation"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700248
249 <module name="InnerAssignment">
250 <property name="severity" value="warning"/>
251 </module>
252
Ray Milkey3f5ef562014-03-25 17:11:19 -0700253 <!-- Many violations of this rule present, revist in a
254 subsequent round of cleanups -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700255 <!-- <module name="MagicNumber"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700256 <module name="MissingSwitchDefault">
257 <property name="severity" value="warning"/>
258 </module>
259
260 <module name="RedundantThrows">
261 <property name="severity" value="warning"/>
262 </module>
263
264 <module name="SimplifyBooleanExpression">
265 <property name="severity" value="warning"/>
266 </module>
267
268 <module name="SimplifyBooleanReturn">
269 <property name="severity" value="warning"/>
270 </module>
271
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700272
273 <!-- Checks for class design -->
274 <!-- See http://checkstyle.sf.net/config_design.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700275 <!-- ONOS produces many warnings of this type.
276 Fixing all of these is outside the scope of the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700277 <!-- <module name="DesignForExtension"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700278 <module name="FinalClass">
279 <property name="severity" value="warning"/>
280 </module>
281
282 <module name="HideUtilityClassConstructor">
283 <property name="severity" value="warning"/>
284 </module>
285
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700286 <module name="InterfaceIsType"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700287
288 <module name="VisibilityModifier">
289 <property name="severity" value="warning"/>
290 </module>
291
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700292
293
294 <!-- Miscellaneous other checks. -->
295 <!-- See http://checkstyle.sf.net/config_misc.html -->
Ray Milkey45614c52014-04-07 16:30:54 -0700296 <module name="ArrayTypeStyle"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700297
Ray Milkey3f5ef562014-03-25 17:11:19 -0700298 <!-- Many violations of this rule currently, too many to fix
299 in the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700300 <!-- <module name="FinalParameters"/> -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700301 <!-- ONOS allows TODO markers in checked in source code -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700302 <!-- <module name="TodoComment"/> -->
303 <module name="UpperEll"/>
304
Ray Milkeyb5716c52014-04-07 11:38:27 -0700305 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700306
Ray Milkeyb5716c52014-04-07 11:38:27 -0700307 </module>