blob: 842e8186274ea0d7e582906834b1f3a06bc68b88 [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001<?xml version="1.0"?>
2<!DOCTYPE module PUBLIC
3 "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4 "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
5
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
34
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
45<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
56 in package-info files -->
57 <!-- <module name="JavadocPackage"/> -->
58
59 <!-- Checks whether files end with a new line. -->
60 <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
61 <module name="NewlineAtEndOfFile"/>
62
63 <!-- Checks that property files contain the same keys. -->
64 <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
65 <module name="Translation"/>
66
67 <!-- Checks for Size Violations. -->
68 <!-- See http://checkstyle.sf.net/config_sizes.html -->
69 <module name="FileLength"/>
70
71 <!-- 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">
78 <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."/>
82 </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
91 <module name="SuppressionCommentFilter">
92 <property name="offCommentFormat" value="(CHECKSTYLE\:OFF|Generated by the protocol buffer compiler.)"/>
93 <property name="onCommentFormat" value="CHECKSTYLE:ON"/>
94 </module>
95
96 <module name="SuppressWithNearbyCommentFilter">
97 <property name="commentFormat" value="CHECKSTYLE IGNORE THIS LINE" />
98 <property name="checkFormat" value=".*" />
99 <property name="influenceFormat" value="0" />
100 </module>
101
102 <!-- Example: // CHECKSTYLE IGNORE FinalClass FOR NEXT 1 LINES -->
103 <module name="SuppressWithNearbyCommentFilter">
104 <property name="commentFormat" value="CHECKSTYLE IGNORE (\w+) FOR NEXT (\d+) LINES"/>
105 <property name="checkFormat" value="$1"/>
106 <property name="influenceFormat" value="$2"/>
107 </module>
108
109 <module name="TreeWalker">
110
111 <module name="FileContentsHolder"/>
112 <!-- Checks for Javadoc comments. -->
113 <!-- See http://checkstyle.sf.net/config_javadoc.html -->
114 <module name="JavadocMethod">
115 <property name="severity" value="warning"/>
116 <property name="allowUndeclaredRTE" value="true"/>
117 </module>
118 <module name="JavadocType">
119 <property name="severity" value="warning"/>
120 </module>
121 <module name="JavadocVariable">
122 <!-- Suppress check for private member Javadocs.
123 Possibly revist fixing these. -->
124 <property name="scope" value="public"/>
125 <property name="severity" value="warning"/>
126 </module>
127 <module name="JavadocStyle"/>
128 <!-- @author tag should not be used -->
129 <module name="WriteTag">
130 <property name="tag" value="@author"/>
131 <property name="tagFormat" value="\S"/>
132 <property name="severity" value="ignore"/>
133 <property name="tagSeverity" value="error"/>
134 </module>
135
136
137 <!-- Checks for Naming Conventions. -->
138 <!-- See http://checkstyle.sf.net/config_naming.html -->
139 <module name="ConstantName">
140 <!-- ONOS allows the name "log" for static final Loggers -->
141 <property name="format"
142 value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
143 </module>
144 <module name="LocalFinalVariableName"/>
145
146 <module name="LocalVariableName"/>
147
148 <module name="MemberName"/>
149 <module name="MethodName"/>
150 <module name="PackageName"/>
151 <module name="ParameterName"/>
152 <module name="StaticVariableName"/>
153 <module name="TypeName"/>
154
155 <!-- Checks for imports -->
156 <!-- See http://checkstyle.sf.net/config_import.html -->
157 <module name="AvoidStarImport">
158 <property name="allowStaticMemberImports" value="true"/>
159 </module>
160 <module name="IllegalImport"/>
161 <!-- defaults to sun.* packages -->
162 <module name="RedundantImport"/>
163 <module name="UnusedImports"/>
164
165
166 <!-- Checks for Size Violations. -->
167 <!-- See http://checkstyle.sf.net/config_sizes.html -->
168 <module name="LineLength">
169 <!-- ONOS standard usage is 80 columns, but we allow up
170 to 120 to not break the build. -->
171 <property name="max" value="120"/>
172 <property name="ignorePattern" value="^import"/>
173 </module>
174 <module name="MethodLength">
175 <property name="max" value="200"/>
176 </module>
177
178 <module name="ParameterNumber"/>
179
180 <!-- Checks for whitespace -->
181 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
182 <module name="EmptyForIteratorPad"/>
183 <module name="GenericWhitespace"/>
184 <module name="MethodParamPad"/>
185 <module name="NoWhitespaceAfter"/>
186 <module name="NoWhitespaceBefore"/>
187
188 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
189 <!-- <module name="OperatorWrap"/> -->
190 <module name="ParenPad"/>
191 <module name="TypecastParenPad"/>
192 <module name="WhitespaceAfter"/>
193 <module name="WhitespaceAround">
194 <property name="allowEmptyConstructors" value="true"/>
195 <property name="allowEmptyMethods" value="true"/>
196 </module>
197
198
199
200 <!-- Modifier Checks -->
201 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
202 <module name="ModifierOrder"/>
203
204 <!-- Disabled for ONOS to allow use of public -->
205 <!-- modifiers in interfaces. -->
206 <!-- <module name="RedundantModifier"/> -->
207
208
209 <!-- Checks for blocks. You know, those {}'s -->
210 <!-- See http://checkstyle.sf.net/config_blocks.html -->
211 <module name="AvoidNestedBlocks">
212 <!-- ONOS alows declarations inside of switch case blocks -->
213 <property name="allowInSwitchCase" value="true"/>
214 </module>
215 <module name="EmptyBlock"/>
216 <module name="LeftCurly"/>
217 <module name="NeedBraces"/>
218 <module name="RightCurly"/>
219
220 <!-- Checks for common coding problems -->
221 <!-- See http://checkstyle.sf.net/config_coding.html -->
222 <!-- ONOS allows conditional operators -->
223 <!-- <module name="AvoidInlineConditionals"/> -->
224 <module name="EmptyStatement"/>
225 <module name="EqualsHashCode"/>
226
227 <module name="HiddenField">
228 <property name="ignoreSetter" value="true"/>
229 <property name="ignoreConstructorParameter" value="true"/>
230 </module>
231
232 <module name="IllegalInstantiation"/>
233 <module name="InnerAssignment"/>
234
235 <!-- Many violations of this rule present, revist in a
236 subsequent round of cleanups -->
237 <!-- <module name="MagicNumber"/> -->
238 <module name="MissingSwitchDefault"/>
239
240 <module name="RedundantThrows">
241 <property name="allowSubclasses" value="true"/>
242 </module>
243
244 <module name="SimplifyBooleanExpression"/>
245 <module name="SimplifyBooleanReturn"/>
246
247 <!-- Checks for class design -->
248 <!-- See http://checkstyle.sf.net/config_design.html -->
249 <!-- ONOS produces many warnings of this type.
250 Fixing all of these is outside the scope of the current cleanup. -->
251 <!-- <module name="DesignForExtension"/> -->
252 <module name="FinalClass"/>
253
254 <module name="HideUtilityClassConstructor"/>
255
256 <module name="InterfaceIsType"/>
257
258 <module name="VisibilityModifier">
259 <property name="severity" value="warning"/>
260 </module>
261
262
263
264 <!-- Miscellaneous other checks. -->
265 <!-- See http://checkstyle.sf.net/config_misc.html -->
266 <module name="ArrayTypeStyle"/>
267
268 <!-- Many violations of this rule currently, too many to fix
269 in the current cleanup. -->
270 <!-- <module name="FinalParameters"/> -->
271 <!-- ONOS allows TODO markers in checked in source code -->
272 <!-- <module name="TodoComment"/> -->
273 <module name="UpperEll"/>
274
275 </module>
276
277 </module>