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