blob: 1bb3b0bf5142dc35a60b4418592e9025099d3c65 [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001<?xml version="1.0"?>
alshabibab984662014-12-04 18:56:18 -08002<!--
3 ~ Copyright 2014 Open Networking Laboratory
4 ~
5 ~ Licensed under the Apache License, Version 2.0 (the "License");
6 ~ you may not use this file except in compliance with the License.
7 ~ You may obtain a copy of the License at
8 ~
9 ~ http://www.apache.org/licenses/LICENSE-2.0
10 ~
11 ~ Unless required by applicable law or agreed to in writing, software
12 ~ distributed under the License is distributed on an "AS IS" BASIS,
13 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ~ See the License for the specific language governing permissions and
15 ~ limitations under the License.
16 -->
tom0eb04ca2014-08-25 14:34:51 -070017<!DOCTYPE module PUBLIC
18 "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
19 "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
20
21
22<!--
23
24 Checkstyle configuration that checks the sun coding conventions from:
25
26 - the Java Language Specification at
27 http://java.sun.com/docs/books/jls/second_edition/html/index.html
28
29 - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
30
31 - the Javadoc guidelines at
32 http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
33
34 - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
35
36 - some best practices
37
38 Checkstyle is very configurable. Be sure to read the documentation at
39 http://checkstyle.sf.net (or in your downloaded distribution).
40
41 Most Checks are configurable, be sure to consult the documentation.
42
43 To completely disable a check, just comment it out or delete it from the file.
44
45 Finally, it is worth reading the documentation.
46
47-->
48
49
50<!--
51 The default severity setting in checkstyle is 'error', so some
52 of the rules below are configured to change the severity to
53 'warning'. Over time, these 'warning' settings should be
54 removed as more of the ONOS source code is modified to
55 follow the recommended rules.
56-->
57
58
59
60<module name="Checker">
61 <!--
62 If you set the basedir property below, then all reported file
63 names will be relative to the specified directory. See
64 http://checkstyle.sourceforge.net/5.x/config.html#Checker
65
66 <property name="basedir" value="${basedir}"/>
67 -->
68 <!-- Checks that a package-info.java file exists for each package. -->
69 <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
70 <!-- ONOS does not currently supply package level Javadoc information
71 in package-info files -->
72 <!-- <module name="JavadocPackage"/> -->
73
74 <!-- Checks whether files end with a new line. -->
75 <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
76 <module name="NewlineAtEndOfFile"/>
77
78 <!-- Checks that property files contain the same keys. -->
79 <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
80 <module name="Translation"/>
81
82 <!-- Checks for Size Violations. -->
83 <!-- See http://checkstyle.sf.net/config_sizes.html -->
84 <module name="FileLength"/>
85
86 <!-- Checks for whitespace -->
87 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
88 <module name="FileTabCharacter"/>
89
90 <!-- Miscellaneous other checks. -->
91 <!-- See http://checkstyle.sf.net/config_misc.html -->
92 <module name="RegexpSingleline">
93 <property name="format" value="\s+$"/>
94 <property name="minimum" value="0"/>
95 <property name="maximum" value="0"/>
96 <property name="message" value="Line has trailing spaces."/>
97 </module>
98
99 <!-- Checks for Headers -->
100 <!-- See http://checkstyle.sf.net/config_header.html -->
101 <!-- <module name="Header"> -->
102 <!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
103 <!-- <property name="fileExtensions" value="java"/> -->
104 <!-- </module> -->
105
106 <module name="SuppressionCommentFilter">
107 <property name="offCommentFormat" value="(CHECKSTYLE\:OFF|Generated by the protocol buffer compiler.)"/>
108 <property name="onCommentFormat" value="CHECKSTYLE:ON"/>
109 </module>
110
111 <module name="SuppressWithNearbyCommentFilter">
112 <property name="commentFormat" value="CHECKSTYLE IGNORE THIS LINE" />
113 <property name="checkFormat" value=".*" />
114 <property name="influenceFormat" value="0" />
115 </module>
116
117 <!-- Example: // CHECKSTYLE IGNORE FinalClass FOR NEXT 1 LINES -->
118 <module name="SuppressWithNearbyCommentFilter">
119 <property name="commentFormat" value="CHECKSTYLE IGNORE (\w+) FOR NEXT (\d+) LINES"/>
120 <property name="checkFormat" value="$1"/>
121 <property name="influenceFormat" value="$2"/>
122 </module>
123
124 <module name="TreeWalker">
125
126 <module name="FileContentsHolder"/>
127 <!-- Checks for Javadoc comments. -->
128 <!-- See http://checkstyle.sf.net/config_javadoc.html -->
129 <module name="JavadocMethod">
130 <property name="severity" value="warning"/>
131 <property name="allowUndeclaredRTE" value="true"/>
132 </module>
133 <module name="JavadocType">
134 <property name="severity" value="warning"/>
135 </module>
136 <module name="JavadocVariable">
137 <!-- Suppress check for private member Javadocs.
138 Possibly revist fixing these. -->
139 <property name="scope" value="public"/>
140 <property name="severity" value="warning"/>
141 </module>
142 <module name="JavadocStyle"/>
143 <!-- @author tag should not be used -->
144 <module name="WriteTag">
145 <property name="tag" value="@author"/>
146 <property name="tagFormat" value="\S"/>
147 <property name="severity" value="ignore"/>
148 <property name="tagSeverity" value="error"/>
149 </module>
150
151
152 <!-- Checks for Naming Conventions. -->
153 <!-- See http://checkstyle.sf.net/config_naming.html -->
154 <module name="ConstantName">
155 <!-- ONOS allows the name "log" for static final Loggers -->
156 <property name="format"
157 value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
158 </module>
159 <module name="LocalFinalVariableName"/>
160
161 <module name="LocalVariableName"/>
162
163 <module name="MemberName"/>
164 <module name="MethodName"/>
165 <module name="PackageName"/>
166 <module name="ParameterName"/>
167 <module name="StaticVariableName"/>
168 <module name="TypeName"/>
169
170 <!-- Checks for imports -->
171 <!-- See http://checkstyle.sf.net/config_import.html -->
172 <module name="AvoidStarImport">
173 <property name="allowStaticMemberImports" value="true"/>
174 </module>
175 <module name="IllegalImport"/>
176 <!-- defaults to sun.* packages -->
177 <module name="RedundantImport"/>
178 <module name="UnusedImports"/>
179
180
181 <!-- Checks for Size Violations. -->
182 <!-- See http://checkstyle.sf.net/config_sizes.html -->
183 <module name="LineLength">
184 <!-- ONOS standard usage is 80 columns, but we allow up
185 to 120 to not break the build. -->
186 <property name="max" value="120"/>
187 <property name="ignorePattern" value="^import"/>
188 </module>
189 <module name="MethodLength">
190 <property name="max" value="200"/>
191 </module>
192
alshabib6b5cfec2014-09-18 17:42:18 -0700193 <module name="ParameterNumber">
alshabibba5ac482014-10-02 17:15:20 -0700194 <property name="max" value="15"/>
alshabib6b5cfec2014-09-18 17:42:18 -0700195 <property name="tokens" value="CTOR_DEF"/>
196 </module>
tom0eb04ca2014-08-25 14:34:51 -0700197 <!-- Checks for whitespace -->
198 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
199 <module name="EmptyForIteratorPad"/>
200 <module name="GenericWhitespace"/>
201 <module name="MethodParamPad"/>
202 <module name="NoWhitespaceAfter"/>
203 <module name="NoWhitespaceBefore"/>
204
205 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
206 <!-- <module name="OperatorWrap"/> -->
207 <module name="ParenPad"/>
208 <module name="TypecastParenPad"/>
209 <module name="WhitespaceAfter"/>
210 <module name="WhitespaceAround">
211 <property name="allowEmptyConstructors" value="true"/>
212 <property name="allowEmptyMethods" value="true"/>
213 </module>
214
215
216
217 <!-- Modifier Checks -->
218 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
219 <module name="ModifierOrder"/>
220
221 <!-- Disabled for ONOS to allow use of public -->
222 <!-- modifiers in interfaces. -->
223 <!-- <module name="RedundantModifier"/> -->
224
225
226 <!-- Checks for blocks. You know, those {}'s -->
227 <!-- See http://checkstyle.sf.net/config_blocks.html -->
228 <module name="AvoidNestedBlocks">
229 <!-- ONOS alows declarations inside of switch case blocks -->
230 <property name="allowInSwitchCase" value="true"/>
231 </module>
HIGUCHI Yuta94a9eed2015-09-25 15:20:04 -0700232 <module name="EmptyBlock">
233 <!-- allow empty block, as long as there's some comment -->
234 <property name="option" value="text"/>
235 </module>
tom0eb04ca2014-08-25 14:34:51 -0700236 <module name="LeftCurly"/>
237 <module name="NeedBraces"/>
238 <module name="RightCurly"/>
239
240 <!-- Checks for common coding problems -->
241 <!-- See http://checkstyle.sf.net/config_coding.html -->
242 <!-- ONOS allows conditional operators -->
243 <!-- <module name="AvoidInlineConditionals"/> -->
244 <module name="EmptyStatement"/>
245 <module name="EqualsHashCode"/>
246
247 <module name="HiddenField">
248 <property name="ignoreSetter" value="true"/>
249 <property name="ignoreConstructorParameter" value="true"/>
250 </module>
251
252 <module name="IllegalInstantiation"/>
253 <module name="InnerAssignment"/>
254
255 <!-- Many violations of this rule present, revist in a
256 subsequent round of cleanups -->
257 <!-- <module name="MagicNumber"/> -->
258 <module name="MissingSwitchDefault"/>
259
260 <module name="RedundantThrows">
261 <property name="allowSubclasses" value="true"/>
262 </module>
263
264 <module name="SimplifyBooleanExpression"/>
265 <module name="SimplifyBooleanReturn"/>
266
267 <!-- Checks for class design -->
268 <!-- See http://checkstyle.sf.net/config_design.html -->
269 <!-- ONOS produces many warnings of this type.
270 Fixing all of these is outside the scope of the current cleanup. -->
271 <!-- <module name="DesignForExtension"/> -->
272 <module name="FinalClass"/>
273
274 <module name="HideUtilityClassConstructor"/>
275
276 <module name="InterfaceIsType"/>
277
278 <module name="VisibilityModifier">
279 <property name="severity" value="warning"/>
280 </module>
281
282
283
284 <!-- Miscellaneous other checks. -->
285 <!-- See http://checkstyle.sf.net/config_misc.html -->
286 <module name="ArrayTypeStyle"/>
287
288 <!-- Many violations of this rule currently, too many to fix
289 in the current cleanup. -->
290 <!-- <module name="FinalParameters"/> -->
291 <!-- ONOS allows TODO markers in checked in source code -->
292 <!-- <module name="TodoComment"/> -->
293 <module name="UpperEll"/>
294
alshabib6b5cfec2014-09-18 17:42:18 -0700295
tom0eb04ca2014-08-25 14:34:51 -0700296 </module>
297
298 </module>