blob: e318f82f4acd6184707e4326aa520ed917a11475 [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 Milkey0b122ed2014-04-14 10:06:03 -070069 <module name="FileLength"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -070070
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070071 <!-- Checks for whitespace -->
72 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
73 <module name="FileTabCharacter"/>
74
75 <!-- Miscellaneous other checks. -->
76 <!-- See http://checkstyle.sf.net/config_misc.html -->
77 <module name="RegexpSingleline">
Ray Milkey3f5ef562014-03-25 17:11:19 -070078 <property name="format" value="\s+$"/>
79 <property name="minimum" value="0"/>
80 <property name="maximum" value="0"/>
81 <property name="message" value="Line has trailing spaces."/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070082 </module>
83
84 <!-- Checks for Headers -->
85 <!-- See http://checkstyle.sf.net/config_header.html -->
86 <!-- <module name="Header"> -->
87 <!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
88 <!-- <property name="fileExtensions" value="java"/> -->
89 <!-- </module> -->
90
Ray Milkey5df613b2014-04-15 10:50:56 -070091 <module name="SuppressionCommentFilter">
Ray Milkey098466c2014-04-22 11:36:46 -070092 <property name="offCommentFormat" value="CHECKSTYLE:OFF"/>
93 <property name="onCommentFormat" value="CHECKSTYLE:ON"/>
Ray Milkey5df613b2014-04-15 10:50:56 -070094 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070095 <module name="TreeWalker">
96
Ray Milkey5df613b2014-04-15 10:50:56 -070097 <module name="FileContentsHolder"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070098 <!-- Checks for Javadoc comments. -->
99 <!-- See http://checkstyle.sf.net/config_javadoc.html -->
Ray Milkeyb5716c52014-04-07 11:38:27 -0700100 <module name="JavadocMethod">
Ray Milkey098466c2014-04-22 11:36:46 -0700101 <property name="severity" value="warning"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700102 </module>
103 <module name="JavadocType">
Ray Milkey098466c2014-04-22 11:36:46 -0700104 <property name="severity" value="warning"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700105 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700106 <module name="JavadocVariable">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700107 <!-- Suppress check for private member Javadocs.
108 Possibly revist fixing these. -->
109 <property name="scope" value="public"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700110 <property name="severity" value="warning"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700111 </module>
Ray Milkeyb41100a2014-04-10 10:42:15 -0700112 <module name="JavadocStyle"/>
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]+)*$"/>
121 </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 Milkey7531a342014-04-11 15:08:12 -0700127 <module name="MethodName"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700128 <module name="PackageName"/>
Ray Milkey9526d6f2014-04-10 14:54:15 -0700129 <module name="ParameterName"/>
Ray Milkey94b41b52014-04-10 11:13:06 -0700130 <module name="StaticVariableName"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700131 <module name="TypeName"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700132
133 <!-- Checks for imports -->
134 <!-- See http://checkstyle.sf.net/config_import.html -->
135 <module name="AvoidStarImport"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700136 <module name="IllegalImport"/>
137 <!-- defaults to sun.* packages -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700138 <module name="RedundantImport"/>
139 <module name="UnusedImports"/>
140
141
142 <!-- Checks for Size Violations. -->
143 <!-- See http://checkstyle.sf.net/config_sizes.html -->
144 <module name="LineLength">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700145 <!-- ONOS standard usage is 80 columns, but we allow up
146 to 120 to not break the build. -->
147 <property name="max" value="120"/>
Ray Milkey098466c2014-04-22 11:36:46 -0700148 <property name="severity" value="warning"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700149 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700150 <module name="MethodLength">
Ray Milkey098466c2014-04-22 11:36:46 -0700151 <property name="max" value="200"/>
152 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700153
Ray Milkeya5450cc2014-04-17 14:31:30 -0700154 <module name="ParameterNumber"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700155
156 <!-- Checks for whitespace -->
157 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
Ray Milkey7f1567c2014-04-08 13:53:32 -0700158 <module name="EmptyForIteratorPad"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700159 <module name="GenericWhitespace"/>
160 <module name="MethodParamPad"/>
Ray Milkey7f1567c2014-04-08 13:53:32 -0700161 <module name="NoWhitespaceAfter"/>
162 <module name="NoWhitespaceBefore"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700163
Ray Milkey3f5ef562014-03-25 17:11:19 -0700164 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700165 <!-- <module name="OperatorWrap"/> -->
166 <module name="ParenPad"/>
167 <module name="TypecastParenPad"/>
Ray Milkey7f1567c2014-04-08 13:53:32 -0700168 <module name="WhitespaceAfter"/>
169 <module name="WhitespaceAround"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700170
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700171
172
173 <!-- Modifier Checks -->
174 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
Ray Milkeyec838942014-04-09 11:28:43 -0700175 <module name="ModifierOrder"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700176
Ray Milkey3f5ef562014-03-25 17:11:19 -0700177 <!-- Disabled for ONOS to allow use of public -->
178 <!-- modifiers in interfaces. -->
179 <!-- <module name="RedundantModifier"/> -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700180
181
182 <!-- Checks for blocks. You know, those {}'s -->
183 <!-- See http://checkstyle.sf.net/config_blocks.html -->
184 <module name="AvoidNestedBlocks">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700185 <!-- ONOS alows declarations inside of switch case blocks -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700186 <property name="allowInSwitchCase" value="true"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700187 </module>
Ray Milkey1aa71f82014-04-08 16:23:24 -0700188 <module name="EmptyBlock"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700189 <module name="LeftCurly"/>
Ray Milkeyb29e6262014-04-09 16:02:14 -0700190 <module name="NeedBraces"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700191 <module name="RightCurly"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700192
193 <!-- Checks for common coding problems -->
194 <!-- See http://checkstyle.sf.net/config_coding.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700195 <!-- ONOS allows conditional operators -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700196 <!-- <module name="AvoidInlineConditionals"/> -->
Ray Milkey043daa22014-04-08 14:13:16 -0700197 <module name="EmptyStatement"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700198 <module name="EqualsHashCode"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700199
200 <module name="HiddenField">
Ray Milkey098466c2014-04-22 11:36:46 -0700201 <property name="ignoreSetter" value="true"/>
202 <property name="ignoreConstructorParameter" value="true"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700203 </module>
204
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700205 <module name="IllegalInstantiation"/>
Ray Milkeyb6e0ac82014-04-09 13:21:42 -0700206 <module name="InnerAssignment"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700207
Ray Milkey3f5ef562014-03-25 17:11:19 -0700208 <!-- Many violations of this rule present, revist in a
209 subsequent round of cleanups -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700210 <!-- <module name="MagicNumber"/> -->
Ray Milkey0b122ed2014-04-14 10:06:03 -0700211 <module name="MissingSwitchDefault"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700212
213 <module name="RedundantThrows">
Ray Milkey098466c2014-04-22 11:36:46 -0700214 <property name="allowSubclasses" value="true"/>
215 </module>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700216
Ray Milkey6c4f2fe2014-04-11 09:47:23 -0700217 <module name="SimplifyBooleanExpression"/>
Ray Milkey4985f212014-04-10 16:57:05 -0700218 <module name="SimplifyBooleanReturn"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700219
220 <!-- Checks for class design -->
221 <!-- See http://checkstyle.sf.net/config_design.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700222 <!-- ONOS produces many warnings of this type.
223 Fixing all of these is outside the scope of the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700224 <!-- <module name="DesignForExtension"/> -->
Ray Milkey1584ec82014-04-10 11:58:30 -0700225 <module name="FinalClass"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700226
Ray Milkeya2e21462014-04-10 13:21:44 -0700227 <module name="HideUtilityClassConstructor"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700228
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700229 <module name="InterfaceIsType"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700230
231 <module name="VisibilityModifier">
Ray Milkey098466c2014-04-22 11:36:46 -0700232 <property name="severity" value="warning"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700233 </module>
234
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700235
236
237 <!-- Miscellaneous other checks. -->
238 <!-- See http://checkstyle.sf.net/config_misc.html -->
Ray Milkey45614c52014-04-07 16:30:54 -0700239 <module name="ArrayTypeStyle"/>
Ray Milkeyb5716c52014-04-07 11:38:27 -0700240
Ray Milkey3f5ef562014-03-25 17:11:19 -0700241 <!-- Many violations of this rule currently, too many to fix
242 in the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700243 <!-- <module name="FinalParameters"/> -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700244 <!-- ONOS allows TODO markers in checked in source code -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700245 <!-- <module name="TodoComment"/> -->
246 <module name="UpperEll"/>
247
Ray Milkeyb5716c52014-04-07 11:38:27 -0700248 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700249
Ray Milkeyb5716c52014-04-07 11:38:27 -0700250 </module>