blob: 57908ddb66c1868233781c4e53a7e8e9a8c8792e [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 Milkey7f1567c2014-04-08 13:53:32 -0700173 <module name="EmptyForIteratorPad"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700174 <module name="GenericWhitespace"/>
175 <module name="MethodParamPad"/>
Ray Milkey7f1567c2014-04-08 13:53:32 -0700176 <module name="NoWhitespaceAfter"/>
177 <module name="NoWhitespaceBefore"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700178
Ray Milkey3f5ef562014-03-25 17:11:19 -0700179 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700180 <!-- <module name="OperatorWrap"/> -->
181 <module name="ParenPad"/>
182 <module name="TypecastParenPad"/>
Ray Milkey7f1567c2014-04-08 13:53:32 -0700183 <module name="WhitespaceAfter"/>
184 <module name="WhitespaceAround"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700185
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700186
187
188 <!-- Modifier Checks -->
189 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700190 <module name="ModifierOrder">
191 <property name="severity" value="warning"/>
192 </module>
193
Ray Milkey3f5ef562014-03-25 17:11:19 -0700194 <!-- Disabled for ONOS to allow use of public -->
195 <!-- modifiers in interfaces. -->
196 <!-- <module name="RedundantModifier"/> -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700197
198
199 <!-- Checks for blocks. You know, those {}'s -->
200 <!-- See http://checkstyle.sf.net/config_blocks.html -->
201 <module name="AvoidNestedBlocks">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700202 <!-- ONOS alows declarations inside of switch case blocks -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700203 <property name="allowInSwitchCase" value="true"/>
204 <property name="severity" value="warning"/>
205 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700206 <module name="EmptyBlock">
207 <property name="severity" value="warning"/>
208 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700209
Ray Milkeyb5716c52014-04-07 11:38:27 -0700210 <module name="LeftCurly"/>
211
212 <module name="NeedBraces">
213 <property name="severity" value="warning"/>
214 </module>
215
216 <module name="RightCurly"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700217
218 <!-- Checks for common coding problems -->
219 <!-- See http://checkstyle.sf.net/config_coding.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700220 <!-- ONOS allows conditional operators -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700221 <!-- <module name="AvoidInlineConditionals"/> -->
Ray Milkey043daa22014-04-08 14:13:16 -0700222 <module name="EmptyStatement"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700223 <module name="EqualsHashCode"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700224
225 <module name="HiddenField">
226 <property name="severity" value="warning"/>
227 </module>
228
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700229 <module name="IllegalInstantiation"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700230
231 <module name="InnerAssignment">
232 <property name="severity" value="warning"/>
233 </module>
234
Ray Milkey3f5ef562014-03-25 17:11:19 -0700235 <!-- Many violations of this rule present, revist in a
236 subsequent round of cleanups -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700237 <!-- <module name="MagicNumber"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700238 <module name="MissingSwitchDefault">
239 <property name="severity" value="warning"/>
240 </module>
241
242 <module name="RedundantThrows">
243 <property name="severity" value="warning"/>
244 </module>
245
246 <module name="SimplifyBooleanExpression">
247 <property name="severity" value="warning"/>
248 </module>
249
250 <module name="SimplifyBooleanReturn">
251 <property name="severity" value="warning"/>
252 </module>
253
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700254
255 <!-- Checks for class design -->
256 <!-- See http://checkstyle.sf.net/config_design.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700257 <!-- ONOS produces many warnings of this type.
258 Fixing all of these is outside the scope of the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700259 <!-- <module name="DesignForExtension"/> -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700260 <module name="FinalClass">
261 <property name="severity" value="warning"/>
262 </module>
263
264 <module name="HideUtilityClassConstructor">
265 <property name="severity" value="warning"/>
266 </module>
267
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700268 <module name="InterfaceIsType"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700269
270 <module name="VisibilityModifier">
271 <property name="severity" value="warning"/>
272 </module>
273
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700274
275
276 <!-- Miscellaneous other checks. -->
277 <!-- See http://checkstyle.sf.net/config_misc.html -->
Ray Milkey45614c52014-04-07 16:30:54 -0700278 <module name="ArrayTypeStyle"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700279
Ray Milkey3f5ef562014-03-25 17:11:19 -0700280 <!-- Many violations of this rule currently, too many to fix
281 in the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700282 <!-- <module name="FinalParameters"/> -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700283 <!-- ONOS allows TODO markers in checked in source code -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700284 <!-- <module name="TodoComment"/> -->
285 <module name="UpperEll"/>
286
Ray Milkeyb5716c52014-04-07 11:38:27 -0700287 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700288
Ray Milkeyb5716c52014-04-07 11:38:27 -0700289 </module>