blob: 09c5e5b1839234b1e6c8e2afc6061833cc801ce5 [file] [log] [blame]
Ray Milkey2d572dd2017-04-14 10:01:24 -07001<?xml version="1.0"?>
2<!--
Brian O'Connora09fe5b2017-08-03 21:12:30 -07003 ~ Copyright 2014-present Open Networking Foundation
Ray Milkey2d572dd2017-04-14 10:01:24 -07004 ~
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 -->
17<!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<module name="Checker">
60 <!--
61 If you set the basedir property below, then all reported file
62 names will be relative to the specified directory. See
63 http://checkstyle.sourceforge.net/5.x/config.html#Checker
64
65 <property name="basedir" value="${basedir}"/>
66 -->
67 <!-- Checks that a package-info.java file exists for each package. -->
68 <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
69 <module name="JavadocPackage"/>
70
71 <!-- Checks whether files end with a new line. -->
72 <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
73 <module name="NewlineAtEndOfFile"/>
74
75 <!-- Checks that property files contain the same keys. -->
76 <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
77 <module name="Translation"/>
78
79 <!-- Checks for Size Violations. -->
80 <!-- See http://checkstyle.sf.net/config_sizes.html -->
81 <module name="FileLength"/>
82
83 <!-- Checks for whitespace -->
84 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
85 <module name="FileTabCharacter"/>
86
87 <!-- Miscellaneous other checks. -->
88 <!-- See http://checkstyle.sf.net/config_misc.html -->
89 <module name="RegexpSingleline">
90 <property name="format" value="\s+$"/>
91 <property name="minimum" value="0"/>
92 <property name="maximum" value="0"/>
93 <property name="message" value="Line has trailing spaces."/>
94 </module>
95
96 <module name="RegexpMultiline">
97 <property name="format" value="\r\n"/>
98 <property name="maximum" value="0"/>
99 <property name="message" value="Line has windows line endings."/>
100 </module>
101
102 <!-- Checks for Headers -->
103 <!-- See http://checkstyle.sf.net/config_header.html -->
104 <!-- <module name="Header"> -->
105 <!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
106 <!-- <property name="fileExtensions" value="java"/> -->
107 <!-- </module> -->
108
109 <module name="RegexpHeader">
110 <!-- The following line is different for maven due to how the maven checkstyle plugin works -->
111 <property name="headerFile" value="${checkstyle.header.file}"/>
112 <property name="fileExtensions" value="java"/>
113 </module>
114
115
116 <module name="SuppressionCommentFilter">
117 <property name="offCommentFormat"
118 value="(CHECKSTYLE\:OFF|Generated by the protocol buffer compiler.)"/>
119 <property name="onCommentFormat" value="CHECKSTYLE:ON"/>
120 </module>
121
122 <module name="SuppressWithNearbyCommentFilter">
123 <property name="commentFormat" value="CHECKSTYLE IGNORE THIS LINE"/>
124 <property name="checkFormat" value=".*"/>
125 <property name="influenceFormat" value="0"/>
126 </module>
127
128 <!-- Example: // CHECKSTYLE IGNORE FinalClass FOR NEXT 1 LINES -->
129 <module name="SuppressWithNearbyCommentFilter">
130 <property name="commentFormat"
131 value="CHECKSTYLE IGNORE (\w+) FOR NEXT (\d+) LINES"/>
132 <property name="checkFormat" value="$1"/>
133 <property name="influenceFormat" value="$2"/>
134 </module>
135
136 <module name="TreeWalker">
137
138 <module name="FileContentsHolder"/>
139 <!-- Checks for Javadoc comments. -->
140 <!-- See http://checkstyle.sf.net/config_javadoc.html -->
141 <module name="JavadocMethod">
142 <property name="scope" value="package"/>
Yuta HIGUCHI9312a802017-06-12 20:01:27 -0700143 <property name="allowMissingJavadoc" value="true"/>
Ray Milkey2d572dd2017-04-14 10:01:24 -0700144 <property name="allowUndeclaredRTE" value="true"/>
Yuta HIGUCHI9312a802017-06-12 20:01:27 -0700145 <property name="suppressLoadErrors" value="true"/>
Ray Milkey2d572dd2017-04-14 10:01:24 -0700146 </module>
147 <module name="JavadocType">
148 <property name="severity" value="warning"/>
149 </module>
150 <module name="JavadocVariable">
151 <!-- Suppress check for private member Javadocs.
152 Possibly revist fixing these. -->
153 <property name="scope" value="public"/>
154 <property name="severity" value="warning"/>
155 </module>
156 <module name="JavadocStyle"/>
157 <!-- @author tag should not be used -->
158 <module name="WriteTag">
159 <property name="tag" value="@author"/>
160 <property name="tagFormat" value="\S"/>
161 <property name="severity" value="ignore"/>
162 <property name="tagSeverity" value="error"/>
163 </module>
164
165 <module name="AbbreviationAsWordInName">
166 <property name="allowedAbbreviationLength" value="2"/>
167 </module>
168
169 <!-- Checks for Naming Conventions. -->
170 <!-- See http://checkstyle.sf.net/config_naming.html -->
171 <module name="ConstantName">
172 <!-- ONOS allows the name "log" for static final Loggers -->
173 <property name="format"
174 value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
175 </module>
176 <module name="LocalFinalVariableName"/>
177
178 <module name="LocalVariableName"/>
179
180 <module name="MemberName"/>
181 <module name="MethodName"/>
182 <module name="PackageName">
183 <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
184 </module>
185 <module name="ParameterName"/>
186 <module name="StaticVariableName"/>
187 <module name="TypeName"/>
188
189 <!-- Checks for imports -->
190 <!-- See http://checkstyle.sf.net/config_import.html -->
191 <module name="AvoidStarImport">
192 <property name="allowStaticMemberImports" value="true"/>
193 </module>
194 <module name="IllegalImport"/>
195 <!-- defaults to sun.* packages -->
196 <module name="RedundantImport"/>
197 <module name="UnusedImports"/>
198
199
200 <!-- Checks for Size Violations. -->
201 <!-- See http://checkstyle.sf.net/config_sizes.html -->
202 <module name="LineLength">
203 <!-- ONOS standard usage is 80 columns, but we allow up
204 to 120 to not break the build. -->
205 <property name="max" value="120"/>
206 <property name="ignorePattern" value="^import"/>
207 </module>
208 <module name="MethodLength">
209 <property name="max" value="200"/>
210 </module>
211
212 <module name="ParameterNumber">
213 <property name="max" value="15"/>
214 <property name="tokens" value="CTOR_DEF"/>
215 </module>
216 <!-- Checks for whitespace -->
217 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
218 <module name="EmptyForIteratorPad"/>
219 <module name="GenericWhitespace"/>
220 <module name="MethodParamPad"/>
221 <module name="NoWhitespaceAfter"/>
222 <module name="NoWhitespaceBefore"/>
223
224 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
225 <!-- <module name="OperatorWrap"/> -->
226 <module name="ParenPad"/>
227 <module name="TypecastParenPad"/>
228 <module name="WhitespaceAfter"/>
229 <module name="WhitespaceAround">
230 <property name="allowEmptyConstructors" value="true"/>
231 <property name="allowEmptyMethods" value="true"/>
232 </module>
233
234
235 <!-- Modifier Checks -->
236 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
237 <module name="ModifierOrder"/>
238
239 <!-- Disabled for ONOS to allow use of public -->
240 <!-- modifiers in interfaces. -->
241 <!-- <module name="RedundantModifier"/> -->
242
243
244 <!-- Checks for blocks. You know, those {}'s -->
245 <!-- See http://checkstyle.sf.net/config_blocks.html -->
246 <module name="AvoidNestedBlocks">
247 <!-- ONOS alows declarations inside of switch case blocks -->
248 <property name="allowInSwitchCase" value="true"/>
249 </module>
250 <module name="EmptyBlock">
251 <!-- allow empty block, as long as there's some comment -->
252 <property name="option" value="text"/>
253 </module>
254 <module name="LeftCurly"/>
255 <module name="NeedBraces"/>
256 <module name="RightCurly"/>
257
258 <!-- Checks for common coding problems -->
259 <!-- See http://checkstyle.sf.net/config_coding.html -->
260 <!-- ONOS allows conditional operators -->
261 <!-- <module name="AvoidInlineConditionals"/> -->
262 <module name="EmptyStatement"/>
263 <module name="EqualsHashCode"/>
264
265 <module name="HiddenField">
266 <property name="ignoreSetter" value="true"/>
267 <property name="ignoreConstructorParameter" value="true"/>
268 </module>
269
270 <module name="IllegalInstantiation"/>
271 <module name="InnerAssignment"/>
272
273 <!-- Many violations of this rule present, revist in a
274 subsequent round of cleanups -->
275 <!-- <module name="MagicNumber"/> -->
276 <module name="MissingSwitchDefault"/>
277
278 <module name="SimplifyBooleanExpression"/>
279 <module name="SimplifyBooleanReturn"/>
280
281 <!-- Checks for class design -->
282 <!-- See http://checkstyle.sf.net/config_design.html -->
283 <!-- ONOS produces many warnings of this type.
284 Fixing all of these is outside the scope of the current cleanup. -->
285 <!-- <module name="DesignForExtension"/> -->
286 <module name="FinalClass"/>
287
288 <module name="HideUtilityClassConstructor"/>
289
290 <module name="InterfaceIsType"/>
291
292 <module name="VisibilityModifier">
293 <property name="severity" value="warning"/>
294 </module>
295
296
297 <!-- Miscellaneous other checks. -->
298 <!-- See http://checkstyle.sf.net/config_misc.html -->
299 <module name="ArrayTypeStyle"/>
300
301 <!-- Many violations of this rule currently, too many to fix
302 in the current cleanup. -->
303 <!-- <module name="FinalParameters"/> -->
304 <!-- ONOS allows TODO markers in checked in source code -->
305 <!-- <module name="TodoComment"/> -->
306 <module name="UpperEll"/>
307 </module>
308
309</module>