Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 1 | <?xml version="1.0"?> |
| 2 | <!DOCTYPE module PUBLIC |
| 3 | "-//Puppy Crawl//DTD Check Configuration 1.3//EN" |
| 4 | "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> |
| 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 | |
| 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"/> |
| 55 | |
| 56 | <!-- Checks for Size Violations. --> |
| 57 | <!-- See http://checkstyle.sf.net/config_sizes.html --> |
| 58 | <module name="FileLength"/> |
| 59 | |
| 60 | <!-- 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"> |
| 67 | <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."/> |
| 71 | </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"> |
| 87 | <!-- Suppress check for private member Javadocs. |
| 88 | Possibly revist fixing these. --> |
| 89 | <property name="scope" value="public"/> |
| 90 | </module> |
| 91 | <module name="JavadocStyle"/> |
| 92 | |
| 93 | |
| 94 | <!-- Checks for Naming Conventions. --> |
| 95 | <!-- See http://checkstyle.sf.net/config_naming.html --> |
Ray Milkey | ec49771 | 2014-03-20 17:51:22 -0700 | [diff] [blame] | 96 | <module name="ConstantName"> |
| 97 | <!-- ONOS allows the name "log" for static final Loggers --> |
| 98 | <property name="format" value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$" /> |
| 99 | </module> |
Yuta HIGUCHI | f980844 | 2014-03-20 15:56:50 -0700 | [diff] [blame] | 100 | <module name="LocalFinalVariableName"/> |
| 101 | <module name="LocalVariableName"/> |
| 102 | <module name="MemberName"/> |
| 103 | <module name="MethodName"/> |
| 104 | <module name="PackageName"/> |
| 105 | <module name="ParameterName"/> |
| 106 | <module name="StaticVariableName"/> |
| 107 | <module name="TypeName"/> |
| 108 | |
| 109 | |
| 110 | <!-- Checks for imports --> |
| 111 | <!-- See http://checkstyle.sf.net/config_import.html --> |
| 112 | <module name="AvoidStarImport"/> |
| 113 | <module name="IllegalImport"/> <!-- defaults to sun.* packages --> |
| 114 | <module name="RedundantImport"/> |
| 115 | <module name="UnusedImports"/> |
| 116 | |
| 117 | |
| 118 | <!-- Checks for Size Violations. --> |
| 119 | <!-- See http://checkstyle.sf.net/config_sizes.html --> |
| 120 | <module name="LineLength"> |
| 121 | <!-- ONOS standard usage is 80 columns, but we allow up |
| 122 | to 120 to not break the build. --> |
| 123 | <property name="max" value="120" /> |
| 124 | </module> |
| 125 | <module name="MethodLength"/> |
| 126 | <module name="ParameterNumber"/> |
| 127 | |
| 128 | |
| 129 | <!-- Checks for whitespace --> |
| 130 | <!-- See http://checkstyle.sf.net/config_whitespace.html --> |
| 131 | <module name="EmptyForIteratorPad"/> |
| 132 | <module name="GenericWhitespace"/> |
| 133 | <module name="MethodParamPad"/> |
| 134 | <module name="NoWhitespaceAfter"/> |
| 135 | <module name="NoWhitespaceBefore"/> |
| 136 | <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator --> |
| 137 | <!-- <module name="OperatorWrap"/> --> |
| 138 | <module name="ParenPad"/> |
| 139 | <module name="TypecastParenPad"/> |
| 140 | <module name="WhitespaceAfter"/> |
| 141 | <module name="WhitespaceAround"/> |
| 142 | |
| 143 | |
| 144 | <!-- Modifier Checks --> |
| 145 | <!-- See http://checkstyle.sf.net/config_modifiers.html --> |
| 146 | <module name="ModifierOrder"/> |
| 147 | <module name="RedundantModifier"/> |
| 148 | |
| 149 | |
| 150 | <!-- Checks for blocks. You know, those {}'s --> |
| 151 | <!-- See http://checkstyle.sf.net/config_blocks.html --> |
| 152 | <module name="AvoidNestedBlocks"> |
| 153 | <!-- ONOS alows declarations inside of switch case blocks --> |
| 154 | <property name="allowInSwitchCase" value="true"/> |
| 155 | <property name="severity" value="warning"/> |
| 156 | </module> |
| 157 | <module name="EmptyBlock"/> |
| 158 | <module name="LeftCurly"/> |
| 159 | <module name="NeedBraces"/> |
| 160 | <module name="RightCurly"/> |
| 161 | |
| 162 | |
| 163 | <!-- Checks for common coding problems --> |
| 164 | <!-- See http://checkstyle.sf.net/config_coding.html --> |
| 165 | <!-- ONOS allows conditional operators --> |
| 166 | <!-- <module name="AvoidInlineConditionals"/> --> |
| 167 | <module name="EmptyStatement"/> |
| 168 | <module name="EqualsHashCode"/> |
| 169 | <module name="HiddenField"/> |
| 170 | <module name="IllegalInstantiation"/> |
| 171 | <module name="InnerAssignment"/> |
| 172 | <!-- Many violations of this rule present, revist in a |
| 173 | subsequent round of cleanups --> |
| 174 | <!-- <module name="MagicNumber"/> --> |
| 175 | <module name="MissingSwitchDefault"/> |
| 176 | <module name="RedundantThrows"/> |
| 177 | <module name="SimplifyBooleanExpression"/> |
| 178 | <module name="SimplifyBooleanReturn"/> |
| 179 | |
| 180 | <!-- Checks for class design --> |
| 181 | <!-- See http://checkstyle.sf.net/config_design.html --> |
| 182 | <!-- ONOS produces many warnings of this type. |
| 183 | Fixing all of these is outside the scope of the current cleanup. --> |
| 184 | <!-- <module name="DesignForExtension"/> --> |
| 185 | <module name="FinalClass"/> |
| 186 | <module name="HideUtilityClassConstructor"/> |
| 187 | <module name="InterfaceIsType"/> |
| 188 | <module name="VisibilityModifier"/> |
| 189 | |
| 190 | |
| 191 | <!-- Miscellaneous other checks. --> |
| 192 | <!-- See http://checkstyle.sf.net/config_misc.html --> |
| 193 | <module name="ArrayTypeStyle"/> |
| 194 | <!-- Many violations of this rule currently, too many to fix |
| 195 | in the current cleanup. --> |
| 196 | <!-- <module name="FinalParameters"/> --> |
| 197 | <!-- ONOS allows TODO markers in checked in source code --> |
| 198 | <!-- <module name="TodoComment"/> --> |
| 199 | <module name="UpperEll"/> |
| 200 | |
| 201 | </module> |
| 202 | |
| 203 | </module> |