blob: e228d1f83740b0dc9980cc259e61955f438a92ae [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."/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070084 </module>
85
86 <!-- Checks for Headers -->
87 <!-- See http://checkstyle.sf.net/config_header.html -->
88 <!-- <module name="Header"> -->
89 <!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
90 <!-- <property name="fileExtensions" value="java"/> -->
91 <!-- </module> -->
92
93 <module name="TreeWalker">
94
95 <!-- Checks for Javadoc comments. -->
96 <!-- See http://checkstyle.sf.net/config_javadoc.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -070097 <module name="JavadocMethod">
98 <property name="severity" value="warning"/>
99 </module>
100 <module name="JavadocType">
101 <property name="severity" value="warning"/>
102 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700103 <module name="JavadocVariable">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700104 <!-- Suppress check for private member Javadocs.
105 Possibly revist fixing these. -->
106 <property name="scope" value="public"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700107 <property name="severity" value="warning"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700108 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700109 <module name="JavadocStyle">
110 <property name="severity" value="warning"/>
111 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700112
113
114 <!-- Checks for Naming Conventions. -->
115 <!-- See http://checkstyle.sf.net/config_naming.html -->
Ray Milkeyec497712014-03-20 17:51:22 -0700116 <module name="ConstantName">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700117 <!-- ONOS allows the name "log" for static final Loggers -->
118 <property name="format"
119 value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700120 <property name="severity" value="warning"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700121 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700122 <module name="LocalFinalVariableName"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700123
Ray Milkey2476cac2014-04-08 11:03:21 -0700124 <module name="LocalVariableName"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700125
Ray Milkey2476cac2014-04-08 11:03:21 -0700126 <module name="MemberName"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700127
128 <module name="MethodName">
129 <property name="severity" value="warning"/>
130 </module>
131
132 <module name="PackageName"/>
133
134 <module name="ParameterName">
135 <property name="severity" value="warning"/>
136 </module>
137
138 <module name="StaticVariableName">
139 <property name="severity" value="warning"/>
140 </module>
141
142 <module name="TypeName"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700143
144 <!-- Checks for imports -->
145 <!-- See http://checkstyle.sf.net/config_import.html -->
146 <module name="AvoidStarImport"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700147 <module name="IllegalImport"/>
148 <!-- defaults to sun.* packages -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700149 <module name="RedundantImport"/>
150 <module name="UnusedImports"/>
151
152
153 <!-- Checks for Size Violations. -->
154 <!-- See http://checkstyle.sf.net/config_sizes.html -->
155 <module name="LineLength">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700156 <!-- ONOS standard usage is 80 columns, but we allow up
157 to 120 to not break the build. -->
158 <property name="max" value="120"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700159 <property name="severity" value="warning"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700160 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700161 <module name="MethodLength">
162 <property name="severity" value="warning"/>
163 </module>
164
165 <module name="ParameterNumber">
166 <property name="severity" value="warning"/>
167 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700168
169
170 <!-- Checks for whitespace -->
171 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
Ray Milkey7f1567c2014-04-08 13:53:32 -0700172 <module name="EmptyForIteratorPad"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700173 <module name="GenericWhitespace"/>
174 <module name="MethodParamPad"/>
Ray Milkey7f1567c2014-04-08 13:53:32 -0700175 <module name="NoWhitespaceAfter"/>
176 <module name="NoWhitespaceBefore"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700177
Ray Milkey3f5ef562014-03-25 17:11:19 -0700178 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700179 <!-- <module name="OperatorWrap"/> -->
180 <module name="ParenPad"/>
181 <module name="TypecastParenPad"/>
Ray Milkey7f1567c2014-04-08 13:53:32 -0700182 <module name="WhitespaceAfter"/>
183 <module name="WhitespaceAround"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700184
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700185
186
187 <!-- Modifier Checks -->
188 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700189 <module name="ModifierOrder">
190 <property name="severity" value="warning"/>
191 </module>
192
Ray Milkey3f5ef562014-03-25 17:11:19 -0700193 <!-- Disabled for ONOS to allow use of public -->
194 <!-- modifiers in interfaces. -->
195 <!-- <module name="RedundantModifier"/> -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700196
197
198 <!-- Checks for blocks. You know, those {}'s -->
199 <!-- See http://checkstyle.sf.net/config_blocks.html -->
200 <module name="AvoidNestedBlocks">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700201 <!-- ONOS alows declarations inside of switch case blocks -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700202 <property name="allowInSwitchCase" value="true"/>
203 <property name="severity" value="warning"/>
204 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700205 <module name="EmptyBlock">
206 <property name="severity" value="warning"/>
207 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700208
Ray Milkeyb5716c52014-04-07 11:38:27 -0700209 <module name="LeftCurly"/>
210
211 <module name="NeedBraces">
212 <property name="severity" value="warning"/>
213 </module>
214
215 <module name="RightCurly"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700216
217 <!-- Checks for common coding problems -->
218 <!-- See http://checkstyle.sf.net/config_coding.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700219 <!-- ONOS allows conditional operators -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700220 <!-- <module name="AvoidInlineConditionals"/> -->
Ray Milkey043daa22014-04-08 14:13:16 -0700221 <module name="EmptyStatement"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700222 <module name="EqualsHashCode"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700223
224 <module name="HiddenField">
225 <property name="severity" value="warning"/>
226 </module>
227
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700228 <module name="IllegalInstantiation"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700229
230 <module name="InnerAssignment">
231 <property name="severity" value="warning"/>
232 </module>
233
Ray Milkey3f5ef562014-03-25 17:11:19 -0700234 <!-- Many violations of this rule present, revist in a
235 subsequent round of cleanups -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700236 <!-- <module name="MagicNumber"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700237 <module name="MissingSwitchDefault">
238 <property name="severity" value="warning"/>
239 </module>
240
241 <module name="RedundantThrows">
242 <property name="severity" value="warning"/>
243 </module>
244
245 <module name="SimplifyBooleanExpression">
246 <property name="severity" value="warning"/>
247 </module>
248
249 <module name="SimplifyBooleanReturn">
250 <property name="severity" value="warning"/>
251 </module>
252
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700253
254 <!-- Checks for class design -->
255 <!-- See http://checkstyle.sf.net/config_design.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700256 <!-- ONOS produces many warnings of this type.
257 Fixing all of these is outside the scope of the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700258 <!-- <module name="DesignForExtension"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700259 <module name="FinalClass">
260 <property name="severity" value="warning"/>
261 </module>
262
263 <module name="HideUtilityClassConstructor">
264 <property name="severity" value="warning"/>
265 </module>
266
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700267 <module name="InterfaceIsType"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700268
269 <module name="VisibilityModifier">
270 <property name="severity" value="warning"/>
271 </module>
272
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700273
274
275 <!-- Miscellaneous other checks. -->
276 <!-- See http://checkstyle.sf.net/config_misc.html -->
Ray Milkey45614c52014-04-07 16:30:54 -0700277 <module name="ArrayTypeStyle"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700278
Ray Milkey3f5ef562014-03-25 17:11:19 -0700279 <!-- Many violations of this rule currently, too many to fix
280 in the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700281 <!-- <module name="FinalParameters"/> -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700282 <!-- ONOS allows TODO markers in checked in source code -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700283 <!-- <module name="TodoComment"/> -->
284 <module name="UpperEll"/>
285
Ray Milkeyb5716c52014-04-07 11:38:27 -0700286 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700287
Ray Milkeyb5716c52014-04-07 11:38:27 -0700288 </module>