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