blob: e9bd3ea1e92cd7f8ebbdb310fb3d0a68e81ddd0d [file] [log] [blame]
Yuta HIGUCHIf9808442014-03-20 15:56:50 -07001<?xml version="1.0"?>
2<!DOCTYPE module PUBLIC
Ray Milkey3f5ef562014-03-25 17:11:19 -07003 "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4 "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
Yuta HIGUCHIf9808442014-03-20 15:56:50 -07005
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<module name="Checker">
35 <!--
36 If you set the basedir property below, then all reported file
37 names will be relative to the specified directory. See
38 http://checkstyle.sourceforge.net/5.x/config.html#Checker
39
40 <property name="basedir" value="${basedir}"/>
41 -->
42 <!-- Checks that a package-info.java file exists for each package. -->
43 <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
44 <!-- ONOS does not currently supply package level Javadoc information
45 in package-info files -->
46 <!-- <module name="JavadocPackage"/> -->
47
48 <!-- Checks whether files end with a new line. -->
49 <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
50 <module name="NewlineAtEndOfFile"/>
51
52 <!-- Checks that property files contain the same keys. -->
53 <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
54 <module name="Translation"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -070055
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070056 <!-- Checks for Size Violations. -->
57 <!-- See http://checkstyle.sf.net/config_sizes.html -->
58 <module name="FileLength"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -070059
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070060 <!-- Checks for whitespace -->
61 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
62 <module name="FileTabCharacter"/>
63
64 <!-- Miscellaneous other checks. -->
65 <!-- See http://checkstyle.sf.net/config_misc.html -->
66 <module name="RegexpSingleline">
Ray Milkey3f5ef562014-03-25 17:11:19 -070067 <property name="format" value="\s+$"/>
68 <property name="minimum" value="0"/>
69 <property name="maximum" value="0"/>
70 <property name="message" value="Line has trailing spaces."/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070071 </module>
72
73 <!-- Checks for Headers -->
74 <!-- See http://checkstyle.sf.net/config_header.html -->
75 <!-- <module name="Header"> -->
76 <!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
77 <!-- <property name="fileExtensions" value="java"/> -->
78 <!-- </module> -->
79
80 <module name="TreeWalker">
81
82 <!-- Checks for Javadoc comments. -->
83 <!-- See http://checkstyle.sf.net/config_javadoc.html -->
84 <module name="JavadocMethod"/>
85 <module name="JavadocType"/>
86 <module name="JavadocVariable">
Ray Milkey3f5ef562014-03-25 17:11:19 -070087 <!-- Suppress check for private member Javadocs.
88 Possibly revist fixing these. -->
89 <property name="scope" value="public"/>
90 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -070091 <module name="JavadocStyle"/>
92
93
94 <!-- Checks for Naming Conventions. -->
95 <!-- See http://checkstyle.sf.net/config_naming.html -->
Ray Milkeyec497712014-03-20 17:51:22 -070096 <module name="ConstantName">
Ray Milkey3f5ef562014-03-25 17:11:19 -070097 <!-- ONOS allows the name "log" for static final Loggers -->
98 <property name="format"
99 value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
100 </module>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700101 <module name="LocalFinalVariableName"/>
102 <module name="LocalVariableName"/>
103 <module name="MemberName"/>
104 <module name="MethodName"/>
105 <module name="PackageName"/>
106 <module name="ParameterName"/>
107 <module name="StaticVariableName"/>
108 <module name="TypeName"/>
109
110
111 <!-- Checks for imports -->
112 <!-- See http://checkstyle.sf.net/config_import.html -->
113 <module name="AvoidStarImport"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700114 <module name="IllegalImport"/>
115 <!-- defaults to sun.* packages -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700116 <module name="RedundantImport"/>
117 <module name="UnusedImports"/>
118
119
120 <!-- Checks for Size Violations. -->
121 <!-- See http://checkstyle.sf.net/config_sizes.html -->
122 <module name="LineLength">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700123 <!-- ONOS standard usage is 80 columns, but we allow up
124 to 120 to not break the build. -->
125 <property name="max" value="120"/>
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700126 </module>
127 <module name="MethodLength"/>
128 <module name="ParameterNumber"/>
129
130
131 <!-- Checks for whitespace -->
132 <!-- See http://checkstyle.sf.net/config_whitespace.html -->
133 <module name="EmptyForIteratorPad"/>
134 <module name="GenericWhitespace"/>
135 <module name="MethodParamPad"/>
136 <module name="NoWhitespaceAfter"/>
137 <module name="NoWhitespaceBefore"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700138 <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700139 <!-- <module name="OperatorWrap"/> -->
140 <module name="ParenPad"/>
141 <module name="TypecastParenPad"/>
142 <module name="WhitespaceAfter"/>
143 <module name="WhitespaceAround"/>
144
145
146 <!-- Modifier Checks -->
147 <!-- See http://checkstyle.sf.net/config_modifiers.html -->
148 <module name="ModifierOrder"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700149 <!-- Disabled for ONOS to allow use of public -->
150 <!-- modifiers in interfaces. -->
151 <!-- <module name="RedundantModifier"/> -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700152
153
154 <!-- Checks for blocks. You know, those {}'s -->
155 <!-- See http://checkstyle.sf.net/config_blocks.html -->
156 <module name="AvoidNestedBlocks">
Ray Milkey3f5ef562014-03-25 17:11:19 -0700157 <!-- ONOS alows declarations inside of switch case blocks -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700158 <property name="allowInSwitchCase" value="true"/>
159 <property name="severity" value="warning"/>
160 </module>
161 <module name="EmptyBlock"/>
162 <module name="LeftCurly"/>
163 <module name="NeedBraces"/>
164 <module name="RightCurly"/>
165
166
167 <!-- Checks for common coding problems -->
168 <!-- See http://checkstyle.sf.net/config_coding.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700169 <!-- ONOS allows conditional operators -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700170 <!-- <module name="AvoidInlineConditionals"/> -->
171 <module name="EmptyStatement"/>
172 <module name="EqualsHashCode"/>
173 <module name="HiddenField"/>
174 <module name="IllegalInstantiation"/>
175 <module name="InnerAssignment"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700176 <!-- Many violations of this rule present, revist in a
177 subsequent round of cleanups -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700178 <!-- <module name="MagicNumber"/> -->
179 <module name="MissingSwitchDefault"/>
180 <module name="RedundantThrows"/>
181 <module name="SimplifyBooleanExpression"/>
182 <module name="SimplifyBooleanReturn"/>
183
184 <!-- Checks for class design -->
185 <!-- See http://checkstyle.sf.net/config_design.html -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700186 <!-- ONOS produces many warnings of this type.
187 Fixing all of these is outside the scope of the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700188 <!-- <module name="DesignForExtension"/> -->
189 <module name="FinalClass"/>
190 <module name="HideUtilityClassConstructor"/>
191 <module name="InterfaceIsType"/>
192 <module name="VisibilityModifier"/>
193
194
195 <!-- Miscellaneous other checks. -->
196 <!-- See http://checkstyle.sf.net/config_misc.html -->
197 <module name="ArrayTypeStyle"/>
Ray Milkey3f5ef562014-03-25 17:11:19 -0700198 <!-- Many violations of this rule currently, too many to fix
199 in the current cleanup. -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700200 <!-- <module name="FinalParameters"/> -->
Ray Milkey3f5ef562014-03-25 17:11:19 -0700201 <!-- ONOS allows TODO markers in checked in source code -->
Yuta HIGUCHIf9808442014-03-20 15:56:50 -0700202 <!-- <module name="TodoComment"/> -->
203 <module name="UpperEll"/>
204
205 </module>
206
207</module>