blob: 0a9772f64b9d91b74e041bbf0fd92bbfc07ba70b [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
Jonathan Hart51539b82015-10-29 09:53:04 -0700149 <module name="AbbreviationAsWordInName">
150 <property name="allowedAbbreviationLength" value="2" />
151 </module>
tom0eb04ca2014-08-25 14:34:51 -0700152
153 <!-- Checks for Naming Conventions. -->
154 <!-- See http://checkstyle.sf.net/config_naming.html -->
155 <module name="ConstantName">
156 <!-- ONOS allows the name "log" for static final Loggers -->
157 <property name="format"
158 value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
159 </module>
160 <module name="LocalFinalVariableName"/>
161
162 <module name="LocalVariableName"/>
163
164 <module name="MemberName"/>
165 <module name="MethodName"/>
Jonathan Hart317f4762015-11-09 16:05:36 -0800166 <module name="PackageName">
167 <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
168 </module>
tom0eb04ca2014-08-25 14:34:51 -0700169 <module name="ParameterName"/>
170 <module name="StaticVariableName"/>
171 <module name="TypeName"/>
172
173 <!-- Checks for imports -->
174 <!-- See http://checkstyle.sf.net/config_import.html -->
175 <module name="AvoidStarImport">
176 <property name="allowStaticMemberImports" value="true"/>
177 </module>
178 <module name="IllegalImport"/>
179 <!-- defaults to sun.* packages -->
180 <module name="RedundantImport"/>
181 <module name="UnusedImports"/>
182
183
184 <!-- Checks for Size Violations. -->
185 <!-- See http://checkstyle.sf.net/config_sizes.html -->
186 <module name="LineLength">
187 <!-- ONOS standard usage is 80 columns, but we allow up
188 to 120 to not break the build. -->
189 <property name="max" value="120"/>
190 <property name="ignorePattern" value="^import"/>
191 </module>
192 <module name="MethodLength">
193 <property name="max" value="200"/>
194 </module>
195
alshabib6b5cfec2014-09-18 17:42:18 -0700196 <module name="ParameterNumber">
alshabibba5ac482014-10-02 17:15:20 -0700197 <property name="max" value="15"/>
alshabib6b5cfec2014-09-18 17:42:18 -0700198 <property name="tokens" value="CTOR_DEF"/>
199 </module>
tom0eb04ca2014-08-25 14:34:51 -0700200 <!-- Checks for whitespace -->
201 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
202 <module name="EmptyForIteratorPad"/>
203 <module name="GenericWhitespace"/>
204 <module name="MethodParamPad"/>
205 <module name="NoWhitespaceAfter"/>
206 <module name="NoWhitespaceBefore"/>
207
208 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
209 <!-- <module name="OperatorWrap"/> -->
210 <module name="ParenPad"/>
211 <module name="TypecastParenPad"/>
212 <module name="WhitespaceAfter"/>
213 <module name="WhitespaceAround">
214 <property name="allowEmptyConstructors" value="true"/>
215 <property name="allowEmptyMethods" value="true"/>
216 </module>
217
218
219
220 <!-- Modifier Checks -->
221 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
222 <module name="ModifierOrder"/>
223
224 <!-- Disabled for ONOS to allow use of public -->
225 <!-- modifiers in interfaces. -->
226 <!-- <module name="RedundantModifier"/> -->
227
228
229 <!-- Checks for blocks. You know, those {}'s -->
230 <!-- See http://checkstyle.sf.net/config_blocks.html -->
231 <module name="AvoidNestedBlocks">
232 <!-- ONOS alows declarations inside of switch case blocks -->
233 <property name="allowInSwitchCase" value="true"/>
234 </module>
HIGUCHI Yuta94a9eed2015-09-25 15:20:04 -0700235 <module name="EmptyBlock">
236 <!-- allow empty block, as long as there's some comment -->
237 <property name="option" value="text"/>
238 </module>
tom0eb04ca2014-08-25 14:34:51 -0700239 <module name="LeftCurly"/>
240 <module name="NeedBraces"/>
241 <module name="RightCurly"/>
242
243 <!-- Checks for common coding problems -->
244 <!-- See http://checkstyle.sf.net/config_coding.html -->
245 <!-- ONOS allows conditional operators -->
246 <!-- <module name="AvoidInlineConditionals"/> -->
247 <module name="EmptyStatement"/>
248 <module name="EqualsHashCode"/>
249
250 <module name="HiddenField">
251 <property name="ignoreSetter" value="true"/>
252 <property name="ignoreConstructorParameter" value="true"/>
253 </module>
254
255 <module name="IllegalInstantiation"/>
256 <module name="InnerAssignment"/>
257
258 <!-- Many violations of this rule present, revist in a
259 subsequent round of cleanups -->
260 <!-- <module name="MagicNumber"/> -->
261 <module name="MissingSwitchDefault"/>
262
tom0eb04ca2014-08-25 14:34:51 -0700263 <module name="SimplifyBooleanExpression"/>
264 <module name="SimplifyBooleanReturn"/>
265
266 <!-- Checks for class design -->
267 <!-- See http://checkstyle.sf.net/config_design.html -->
268 <!-- ONOS produces many warnings of this type.
269 Fixing all of these is outside the scope of the current cleanup. -->
270 <!-- <module name="DesignForExtension"/> -->
271 <module name="FinalClass"/>
272
273 <module name="HideUtilityClassConstructor"/>
274
275 <module name="InterfaceIsType"/>
276
277 <module name="VisibilityModifier">
278 <property name="severity" value="warning"/>
279 </module>
280
281
282
283 <!-- Miscellaneous other checks. -->
284 <!-- See http://checkstyle.sf.net/config_misc.html -->
285 <module name="ArrayTypeStyle"/>
286
287 <!-- Many violations of this rule currently, too many to fix
288 in the current cleanup. -->
289 <!-- <module name="FinalParameters"/> -->
290 <!-- ONOS allows TODO markers in checked in source code -->
291 <!-- <module name="TodoComment"/> -->
292 <module name="UpperEll"/>
293
alshabib6b5cfec2014-09-18 17:42:18 -0700294
tom0eb04ca2014-08-25 14:34:51 -0700295 </module>
296
297 </module>