blob: cbc0cc6f4788e7729d36f75c686896b84054cff5 [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">
Yuta HIGUCHIcbbaed32014-05-14 20:27:43 -070046 <module name="SuppressionFilter">
47 <property name="file" value="${config_loc}/onos_suppressions.xml"/>
48 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070049 <!--
50 If you set the basedir property below, then all reported file
51 names will be relative to the specified directory. See
52 http://checkstyle.sourceforge.net/5.x/config.html#Checker
53
54 <property name="basedir" value="${basedir}"/>
55 -->
56 <!-- Checks that a package-info.java file exists for each package. -->
57 <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
58 <!-- ONOS does not currently supply package level Javadoc information
Ray Milkeyb5716c52014-04-07 11:38:27 -070059 in package-info files -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070060 <!-- <module name="JavadocPackage"/> -->
61
62 <!-- Checks whether files end with a new line. -->
63 <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
Ray Milkey0f913a02014-04-07 20:58:17 -070064 <module name="NewlineAtEndOfFile"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070065
66 <!-- Checks that property files contain the same keys. -->
67 <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
68 <module name="Translation"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -070069
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070070 <!-- Checks for Size Violations. -->
71 <!-- See http://checkstyle.sf.net/config_sizes.html -->
Ray Milkey0b122ed2014-04-14 10:06:03 -070072 <module name="FileLength"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -070073
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070074 <!-- Checks for whitespace -->
75 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
76 <module name="FileTabCharacter"/>
77
78 <!-- Miscellaneous other checks. -->
79 <!-- See http://checkstyle.sf.net/config_misc.html -->
80 <module name="RegexpSingleline">
Ray Milkey3f5ef562014-03-25 17:11:19 -070081 <property name="format" value="\s+$"/>
82 <property name="minimum" value="0"/>
83 <property name="maximum" value="0"/>
84 <property name="message" value="Line has trailing spaces."/>
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
Ray Milkey5df613b2014-04-15 10:50:56 -070094 <module name="SuppressionCommentFilter">
Yuta HIGUCHIa4d51d42014-06-19 17:54:09 -070095 <property name="offCommentFormat" value="(CHECKSTYLE\:OFF|Generated by the protocol buffer compiler.)"/>
Ray Milkey098466c2014-04-22 11:36:46 -070096 <property name="onCommentFormat" value="CHECKSTYLE:ON"/>
Ray Milkey5df613b2014-04-15 10:50:56 -070097 </module>
Yuta HIGUCHI5dc86642014-06-25 14:13:45 -070098
99 <module name="SuppressWithNearbyCommentFilter">
100 <property name="commentFormat" value="CHECKSTYLE IGNORE THIS LINE" />
101 <property name="checkFormat" value=".*" />
102 <property name="influenceFormat" value="0" />
103 </module>
104
105 <!-- Example: // CHECKSTYLE IGNORE FinalClass FOR NEXT 1 LINES -->
106 <module name="SuppressWithNearbyCommentFilter">
107 <property name="commentFormat" value="CHECKSTYLE IGNORE (\w+) FOR NEXT (\d+) LINES"/>
108 <property name="checkFormat" value="$1"/>
109 <property name="influenceFormat" value="$2"/>
110 </module>
111
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700112 <module name="TreeWalker">
113
Ray Milkey5df613b2014-04-15 10:50:56 -0700114 <module name="FileContentsHolder"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700115 <!-- Checks for Javadoc comments. -->
116 <!-- See http://checkstyle.sf.net/config_javadoc.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700117 <module name="JavadocMethod">
Ray Milkey098466c2014-04-22 11:36:46 -0700118 <property name="severity" value="warning"/>
Yuta HIGUCHIcd0f0422014-08-02 16:33:39 -0700119 <property name="allowUndeclaredRTE" value="true"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700120 </module>
121 <module name="JavadocType">
Ray Milkey098466c2014-04-22 11:36:46 -0700122 <property name="severity" value="warning"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700123 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700124 <module name="JavadocVariable">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700125 <!-- Suppress check for private member Javadocs.
126 Possibly revist fixing these. -->
127 <property name="scope" value="public"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700128 <property name="severity" value="warning"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700129 </module>
Ray Milkeyb41100a2014-04-10 10:42:15 -0700130 <module name="JavadocStyle"/>
Yuta HIGUCHIaa132f52014-06-26 10:18:39 -0700131 <!-- @author tag should not be used -->
132 <module name="WriteTag">
133 <property name="tag" value="@author"/>
134 <property name="tagFormat" value="\S"/>
135 <property name="severity" value="ignore"/>
136 <property name="tagSeverity" value="error"/>
137 </module>
138
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700139
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700140 <!-- Checks for Naming Conventions. -->
141 <!-- See http://checkstyle.sf.net/config_naming.html -->
Ray Milkeyec497712014-03-20 17:51:22 -0700142 <module name="ConstantName">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700143 <!-- ONOS allows the name "log" for static final Loggers -->
144 <property name="format"
145 value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
146 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700147 <module name="LocalFinalVariableName"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700148
Ray Milkey2476cac2014-04-08 11:03:21 -0700149 <module name="LocalVariableName"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700150
Ray Milkey2476cac2014-04-08 11:03:21 -0700151 <module name="MemberName"/>
Ray Milkey7531a342014-04-11 15:08:12 -0700152 <module name="MethodName"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700153 <module name="PackageName"/>
Ray Milkey9526d6f2014-04-10 14:54:15 -0700154 <module name="ParameterName"/>
Ray Milkey94b41b52014-04-10 11:13:06 -0700155 <module name="StaticVariableName"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700156 <module name="TypeName"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700157
158 <!-- Checks for imports -->
159 <!-- See http://checkstyle.sf.net/config_import.html -->
Yuta HIGUCHI91a8f502014-06-17 10:15:29 -0700160 <module name="AvoidStarImport">
161 <property name="allowStaticMemberImports" value="true"/>
162 </module>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700163 <module name="IllegalImport"/>
164 <!-- defaults to sun.* packages -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700165 <module name="RedundantImport"/>
166 <module name="UnusedImports"/>
167
168
169 <!-- Checks for Size Violations. -->
170 <!-- See http://checkstyle.sf.net/config_sizes.html -->
171 <module name="LineLength">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700172 <!-- ONOS standard usage is 80 columns, but we allow up
173 to 120 to not break the build. -->
174 <property name="max" value="120"/>
Yuta HIGUCHI927a3fe2014-06-11 22:14:43 -0700175 <property name="ignorePattern" value="^import"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700176 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700177 <module name="MethodLength">
Ray Milkey098466c2014-04-22 11:36:46 -0700178 <property name="max" value="200"/>
179 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700180
Ray Milkey5bf7f6f2014-08-15 10:20:40 -0700181 <!-- This rule modification should be removed when the code that
182 uses long parameter lists is refactored. Intents and Topology
183 violate this standard. -->
184 <module name="ParameterNumber">
185 <property name="max" value="10"/>
186 <property name="tokens" value="METHOD_DEF"/>
187 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700188
189 <!-- Checks for whitespace -->
190 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
Ray Milkey7f1567c2014-04-08 13:53:32 -0700191 <module name="EmptyForIteratorPad"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700192 <module name="GenericWhitespace"/>
193 <module name="MethodParamPad"/>
Ray Milkey7f1567c2014-04-08 13:53:32 -0700194 <module name="NoWhitespaceAfter"/>
195 <module name="NoWhitespaceBefore"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700196
Ray Milkey3f5ef562014-03-25 17:11:19 -0700197 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700198 <!-- <module name="OperatorWrap"/> -->
199 <module name="ParenPad"/>
200 <module name="TypecastParenPad"/>
Ray Milkey7f1567c2014-04-08 13:53:32 -0700201 <module name="WhitespaceAfter"/>
Yuta HIGUCHI5a3e2cf2014-05-20 10:46:35 -0700202 <module name="WhitespaceAround">
203 <property name="allowEmptyConstructors" value="true"/>
204 <property name="allowEmptyMethods" value="true"/>
205 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700206
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700207
208
209 <!-- Modifier Checks -->
210 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
Ray Milkeyec838942014-04-09 11:28:43 -0700211 <module name="ModifierOrder"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700212
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"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700223 </module>
Ray Milkey1aa71f82014-04-08 16:23:24 -0700224 <module name="EmptyBlock"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700225 <module name="LeftCurly"/>
Ray Milkeyb29e6262014-04-09 16:02:14 -0700226 <module name="NeedBraces"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700227 <module name="RightCurly"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700228
229 <!-- Checks for common coding problems -->
230 <!-- See http://checkstyle.sf.net/config_coding.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700231 <!-- ONOS allows conditional operators -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700232 <!-- <module name="AvoidInlineConditionals"/> -->
Ray Milkey043daa22014-04-08 14:13:16 -0700233 <module name="EmptyStatement"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700234 <module name="EqualsHashCode"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700235
236 <module name="HiddenField">
Ray Milkey098466c2014-04-22 11:36:46 -0700237 <property name="ignoreSetter" value="true"/>
238 <property name="ignoreConstructorParameter" value="true"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700239 </module>
240
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700241 <module name="IllegalInstantiation"/>
Ray Milkeyb6e0ac82014-04-09 13:21:42 -0700242 <module name="InnerAssignment"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700243
Ray Milkey3f5ef562014-03-25 17:11:19 -0700244 <!-- Many violations of this rule present, revist in a
245 subsequent round of cleanups -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700246 <!-- <module name="MagicNumber"/> -->
Ray Milkey0b122ed2014-04-14 10:06:03 -0700247 <module name="MissingSwitchDefault"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700248
249 <module name="RedundantThrows">
Ray Milkey098466c2014-04-22 11:36:46 -0700250 <property name="allowSubclasses" value="true"/>
251 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700252
Ray Milkey6c4f2fe2014-04-11 09:47:23 -0700253 <module name="SimplifyBooleanExpression"/>
Ray Milkey4985f212014-04-10 16:57:05 -0700254 <module name="SimplifyBooleanReturn"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700255
256 <!-- Checks for class design -->
257 <!-- See http://checkstyle.sf.net/config_design.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700258 <!-- ONOS produces many warnings of this type.
259 Fixing all of these is outside the scope of the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700260 <!-- <module name="DesignForExtension"/> -->
Ray Milkey1584ec82014-04-10 11:58:30 -0700261 <module name="FinalClass"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700262
Ray Milkeya2e21462014-04-10 13:21:44 -0700263 <module name="HideUtilityClassConstructor"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700264
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700265 <module name="InterfaceIsType"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700266
267 <module name="VisibilityModifier">
Ray Milkey098466c2014-04-22 11:36:46 -0700268 <property name="severity" value="warning"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700269 </module>
270
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700271
272
273 <!-- Miscellaneous other checks. -->
274 <!-- See http://checkstyle.sf.net/config_misc.html -->
Ray Milkey45614c52014-04-07 16:30:54 -0700275 <module name="ArrayTypeStyle"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700276
Ray Milkey3f5ef562014-03-25 17:11:19 -0700277 <!-- Many violations of this rule currently, too many to fix
278 in the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700279 <!-- <module name="FinalParameters"/> -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700280 <!-- ONOS allows TODO markers in checked in source code -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700281 <!-- <module name="TodoComment"/> -->
282 <module name="UpperEll"/>
283
Ray Milkeyb5716c52014-04-07 11:38:27 -0700284 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700285
Ray Milkeyb5716c52014-04-07 11:38:27 -0700286 </module>