Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 1 | <?xml version="1.0"?> |
| 2 | <!DOCTYPE module PUBLIC |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 3 | "-//Puppy Crawl//DTD Check Configuration 1.3//EN" |
| 4 | "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 5 | |
| 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 | |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 34 | |
| 35 | <!-- |
| 36 | The default severity setting in checkstyle is 'error', so some |
| 37 | of the rules below are configured to change the severity to |
| 38 | 'warning'. Over time, these 'warning' settings should be |
| 39 | removed as more of the ONOS source code is modified to |
| 40 | follow the recommended rules. |
| 41 | --> |
| 42 | |
| 43 | |
| 44 | |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 45 | <module name="Checker"> |
Yuta HIGUCHI | cbbaed3 | 2014-05-14 20:27:43 -0700 | [diff] [blame] | 46 | <module name="SuppressionFilter"> |
| 47 | <property name="file" value="${config_loc}/onos_suppressions.xml"/> |
| 48 | </module> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 49 | <!-- |
| 50 | If you set the basedir property below, then all reported file |
| 51 | names will be relative to the specified directory. See |
| 52 | http://checkstyle.sourceforge.net/5.x/config.html#Checker |
| 53 | |
| 54 | <property name="basedir" value="${basedir}"/> |
| 55 | --> |
| 56 | <!-- Checks that a package-info.java file exists for each package. --> |
| 57 | <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage --> |
| 58 | <!-- ONOS does not currently supply package level Javadoc information |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 59 | in package-info files --> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 60 | <!-- <module name="JavadocPackage"/> --> |
| 61 | |
| 62 | <!-- Checks whether files end with a new line. --> |
| 63 | <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> |
Ray Milkey | 0f913a0 | 2014-04-07 20:58:17 -0700 | [diff] [blame] | 64 | <module name="NewlineAtEndOfFile"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 65 | |
| 66 | <!-- Checks that property files contain the same keys. --> |
| 67 | <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> |
| 68 | <module name="Translation"/> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 69 | |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 70 | <!-- Checks for Size Violations. --> |
| 71 | <!-- See http://checkstyle.sf.net/config_sizes.html --> |
Ray Milkey | 0b122ed | 2014-04-14 10:06:03 -0700 | [diff] [blame] | 72 | <module name="FileLength"/> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 73 | |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 74 | <!-- Checks for whitespace --> |
| 75 | <!-- See http://checkstyle.sf.net/config_whitespace.html --> |
| 76 | <module name="FileTabCharacter"/> |
| 77 | |
| 78 | <!-- Miscellaneous other checks. --> |
| 79 | <!-- See http://checkstyle.sf.net/config_misc.html --> |
| 80 | <module name="RegexpSingleline"> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 81 | <property name="format" value="\s+$"/> |
| 82 | <property name="minimum" value="0"/> |
| 83 | <property name="maximum" value="0"/> |
| 84 | <property name="message" value="Line has trailing spaces."/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 85 | </module> |
| 86 | |
| 87 | <!-- Checks for Headers --> |
| 88 | <!-- See http://checkstyle.sf.net/config_header.html --> |
| 89 | <!-- <module name="Header"> --> |
| 90 | <!-- <property name="headerFile" value="${checkstyle.header.file}"/> --> |
| 91 | <!-- <property name="fileExtensions" value="java"/> --> |
| 92 | <!-- </module> --> |
| 93 | |
Ray Milkey | 5df613b | 2014-04-15 10:50:56 -0700 | [diff] [blame] | 94 | <module name="SuppressionCommentFilter"> |
Ray Milkey | 098466c | 2014-04-22 11:36:46 -0700 | [diff] [blame] | 95 | <property name="offCommentFormat" value="CHECKSTYLE:OFF"/> |
| 96 | <property name="onCommentFormat" value="CHECKSTYLE:ON"/> |
Ray Milkey | 5df613b | 2014-04-15 10:50:56 -0700 | [diff] [blame] | 97 | </module> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 98 | <module name="TreeWalker"> |
| 99 | |
Ray Milkey | 5df613b | 2014-04-15 10:50:56 -0700 | [diff] [blame] | 100 | <module name="FileContentsHolder"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 101 | <!-- Checks for Javadoc comments. --> |
| 102 | <!-- See http://checkstyle.sf.net/config_javadoc.html --> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 103 | <module name="JavadocMethod"> |
Ray Milkey | 098466c | 2014-04-22 11:36:46 -0700 | [diff] [blame] | 104 | <property name="severity" value="warning"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 105 | </module> |
| 106 | <module name="JavadocType"> |
Ray Milkey | 098466c | 2014-04-22 11:36:46 -0700 | [diff] [blame] | 107 | <property name="severity" value="warning"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 108 | </module> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 109 | <module name="JavadocVariable"> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 110 | <!-- Suppress check for private member Javadocs. |
| 111 | Possibly revist fixing these. --> |
| 112 | <property name="scope" value="public"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 113 | <property name="severity" value="warning"/> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 114 | </module> |
Ray Milkey | b41100a | 2014-04-10 10:42:15 -0700 | [diff] [blame] | 115 | <module name="JavadocStyle"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 116 | |
| 117 | |
| 118 | <!-- Checks for Naming Conventions. --> |
| 119 | <!-- See http://checkstyle.sf.net/config_naming.html --> |
Ray Milkey | ec49771 | 2014-03-20 17:51:22 -0700 | [diff] [blame] | 120 | <module name="ConstantName"> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 121 | <!-- ONOS allows the name "log" for static final Loggers --> |
| 122 | <property name="format" |
| 123 | value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/> |
| 124 | </module> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 125 | <module name="LocalFinalVariableName"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 126 | |
Ray Milkey | 2476cac | 2014-04-08 11:03:21 -0700 | [diff] [blame] | 127 | <module name="LocalVariableName"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 128 | |
Ray Milkey | 2476cac | 2014-04-08 11:03:21 -0700 | [diff] [blame] | 129 | <module name="MemberName"/> |
Ray Milkey | 7531a34 | 2014-04-11 15:08:12 -0700 | [diff] [blame] | 130 | <module name="MethodName"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 131 | <module name="PackageName"/> |
Ray Milkey | 9526d6f | 2014-04-10 14:54:15 -0700 | [diff] [blame] | 132 | <module name="ParameterName"/> |
Ray Milkey | 94b41b5 | 2014-04-10 11:13:06 -0700 | [diff] [blame] | 133 | <module name="StaticVariableName"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 134 | <module name="TypeName"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 135 | |
| 136 | <!-- Checks for imports --> |
| 137 | <!-- See http://checkstyle.sf.net/config_import.html --> |
| 138 | <module name="AvoidStarImport"/> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 139 | <module name="IllegalImport"/> |
| 140 | <!-- defaults to sun.* packages --> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 141 | <module name="RedundantImport"/> |
| 142 | <module name="UnusedImports"/> |
| 143 | |
| 144 | |
| 145 | <!-- Checks for Size Violations. --> |
| 146 | <!-- See http://checkstyle.sf.net/config_sizes.html --> |
| 147 | <module name="LineLength"> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 148 | <!-- ONOS standard usage is 80 columns, but we allow up |
| 149 | to 120 to not break the build. --> |
| 150 | <property name="max" value="120"/> |
Ray Milkey | 098466c | 2014-04-22 11:36:46 -0700 | [diff] [blame] | 151 | <property name="severity" value="warning"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 152 | </module> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 153 | <module name="MethodLength"> |
Ray Milkey | 098466c | 2014-04-22 11:36:46 -0700 | [diff] [blame] | 154 | <property name="max" value="200"/> |
| 155 | </module> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 156 | |
Ray Milkey | a5450cc | 2014-04-17 14:31:30 -0700 | [diff] [blame] | 157 | <module name="ParameterNumber"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 158 | |
| 159 | <!-- Checks for whitespace --> |
| 160 | <!-- See http://checkstyle.sf.net/config_whitespace.html --> |
Ray Milkey | 7f1567c | 2014-04-08 13:53:32 -0700 | [diff] [blame] | 161 | <module name="EmptyForIteratorPad"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 162 | <module name="GenericWhitespace"/> |
| 163 | <module name="MethodParamPad"/> |
Ray Milkey | 7f1567c | 2014-04-08 13:53:32 -0700 | [diff] [blame] | 164 | <module name="NoWhitespaceAfter"/> |
| 165 | <module name="NoWhitespaceBefore"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 166 | |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 167 | <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator --> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 168 | <!-- <module name="OperatorWrap"/> --> |
| 169 | <module name="ParenPad"/> |
| 170 | <module name="TypecastParenPad"/> |
Ray Milkey | 7f1567c | 2014-04-08 13:53:32 -0700 | [diff] [blame] | 171 | <module name="WhitespaceAfter"/> |
Yuta HIGUCHI | 5a3e2cf | 2014-05-20 10:46:35 -0700 | [diff] [blame] | 172 | <module name="WhitespaceAround"> |
| 173 | <property name="allowEmptyConstructors" value="true"/> |
| 174 | <property name="allowEmptyMethods" value="true"/> |
| 175 | </module> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 176 | |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 177 | |
| 178 | |
| 179 | <!-- Modifier Checks --> |
| 180 | <!-- See http://checkstyle.sf.net/config_modifiers.html --> |
Ray Milkey | ec83894 | 2014-04-09 11:28:43 -0700 | [diff] [blame] | 181 | <module name="ModifierOrder"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 182 | |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 183 | <!-- Disabled for ONOS to allow use of public --> |
| 184 | <!-- modifiers in interfaces. --> |
| 185 | <!-- <module name="RedundantModifier"/> --> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 186 | |
| 187 | |
| 188 | <!-- Checks for blocks. You know, those {}'s --> |
| 189 | <!-- See http://checkstyle.sf.net/config_blocks.html --> |
| 190 | <module name="AvoidNestedBlocks"> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 191 | <!-- ONOS alows declarations inside of switch case blocks --> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 192 | <property name="allowInSwitchCase" value="true"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 193 | </module> |
Ray Milkey | 1aa71f8 | 2014-04-08 16:23:24 -0700 | [diff] [blame] | 194 | <module name="EmptyBlock"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 195 | <module name="LeftCurly"/> |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 196 | <module name="NeedBraces"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 197 | <module name="RightCurly"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 198 | |
| 199 | <!-- Checks for common coding problems --> |
| 200 | <!-- See http://checkstyle.sf.net/config_coding.html --> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 201 | <!-- ONOS allows conditional operators --> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 202 | <!-- <module name="AvoidInlineConditionals"/> --> |
Ray Milkey | 043daa2 | 2014-04-08 14:13:16 -0700 | [diff] [blame] | 203 | <module name="EmptyStatement"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 204 | <module name="EqualsHashCode"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 205 | |
| 206 | <module name="HiddenField"> |
Ray Milkey | 098466c | 2014-04-22 11:36:46 -0700 | [diff] [blame] | 207 | <property name="ignoreSetter" value="true"/> |
| 208 | <property name="ignoreConstructorParameter" value="true"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 209 | </module> |
| 210 | |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 211 | <module name="IllegalInstantiation"/> |
Ray Milkey | b6e0ac8 | 2014-04-09 13:21:42 -0700 | [diff] [blame] | 212 | <module name="InnerAssignment"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 213 | |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 214 | <!-- Many violations of this rule present, revist in a |
| 215 | subsequent round of cleanups --> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 216 | <!-- <module name="MagicNumber"/> --> |
Ray Milkey | 0b122ed | 2014-04-14 10:06:03 -0700 | [diff] [blame] | 217 | <module name="MissingSwitchDefault"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 218 | |
| 219 | <module name="RedundantThrows"> |
Ray Milkey | 098466c | 2014-04-22 11:36:46 -0700 | [diff] [blame] | 220 | <property name="allowSubclasses" value="true"/> |
| 221 | </module> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 222 | |
Ray Milkey | 6c4f2fe | 2014-04-11 09:47:23 -0700 | [diff] [blame] | 223 | <module name="SimplifyBooleanExpression"/> |
Ray Milkey | 4985f21 | 2014-04-10 16:57:05 -0700 | [diff] [blame] | 224 | <module name="SimplifyBooleanReturn"/> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 225 | |
| 226 | <!-- Checks for class design --> |
| 227 | <!-- See http://checkstyle.sf.net/config_design.html --> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 228 | <!-- ONOS produces many warnings of this type. |
| 229 | Fixing all of these is outside the scope of the current cleanup. --> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 230 | <!-- <module name="DesignForExtension"/> --> |
Ray Milkey | 1584ec8 | 2014-04-10 11:58:30 -0700 | [diff] [blame] | 231 | <module name="FinalClass"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 232 | |
Ray Milkey | a2e2146 | 2014-04-10 13:21:44 -0700 | [diff] [blame] | 233 | <module name="HideUtilityClassConstructor"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 234 | |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 235 | <module name="InterfaceIsType"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 236 | |
| 237 | <module name="VisibilityModifier"> |
Ray Milkey | 098466c | 2014-04-22 11:36:46 -0700 | [diff] [blame] | 238 | <property name="severity" value="warning"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 239 | </module> |
| 240 | |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 241 | |
| 242 | |
| 243 | <!-- Miscellaneous other checks. --> |
| 244 | <!-- See http://checkstyle.sf.net/config_misc.html --> |
Ray Milkey | 45614c5 | 2014-04-07 16:30:54 -0700 | [diff] [blame] | 245 | <module name="ArrayTypeStyle"/> |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 246 | |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 247 | <!-- Many violations of this rule currently, too many to fix |
| 248 | in the current cleanup. --> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 249 | <!-- <module name="FinalParameters"/> --> |
Ray Milkey | 3f5ef56 | 2014-03-25 17:11:19 -0700 | [diff] [blame] | 250 | <!-- ONOS allows TODO markers in checked in source code --> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 251 | <!-- <module name="TodoComment"/> --> |
| 252 | <module name="UpperEll"/> |
| 253 | |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 254 | </module> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 255 | |
Ray Milkey | b5716c5 | 2014-04-07 11:38:27 -0700 | [diff] [blame] | 256 | </module> |