|
| 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 | + Checkstyle configuration that checks the sun coding conventions from: |
| 9 | +
|
| 10 | + - the Java Language Specification at |
| 11 | + http://java.sun.com/docs/books/jls/second_edition/html/index.html |
| 12 | +
|
| 13 | + - the Sun Code Conventions at http://java.sun.com/docs/codeconv/ |
| 14 | +
|
| 15 | + - the Javadoc guidelines at |
| 16 | + http://java.sun.com/j2se/javadoc/writingdoccomments/index.html |
| 17 | +
|
| 18 | + - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html |
| 19 | +
|
| 20 | + - some best practices |
| 21 | +
|
| 22 | + Checkstyle is very configurable. Be sure to read the documentation at |
| 23 | + http://checkstyle.sf.net (or in your downloaded distribution). |
| 24 | +
|
| 25 | + Most Checks are configurable, be sure to consult the documentation. |
| 26 | +
|
| 27 | + To completely disable a check, just comment it out or delete it from the file. |
| 28 | +
|
| 29 | + Finally, it is worth reading the documentation. |
| 30 | +
|
| 31 | +--> |
| 32 | + |
| 33 | +<module name="Checker"> |
| 34 | + <!-- |
| 35 | + If you set the basedir property below, then all reported file |
| 36 | + names will be relative to the specified directory. See |
| 37 | + http://checkstyle.sourceforge.net/5.x/config.html#Checker |
| 38 | +
|
| 39 | + <property name="basedir" value="${basedir}"/> |
| 40 | + --> |
| 41 | + |
| 42 | + <property name="fileExtensions" value="java"/> |
| 43 | + |
| 44 | + <!-- Part of turning off indivial checks: --> |
| 45 | + <!-- http://stackoverflow.com/questions/4023185/how-to-disable-a-particular-checkstyle-rule-for-a-particular-line-of-code --> |
| 46 | + <module name="SuppressWarningsFilter" /> |
| 47 | + |
| 48 | + <!-- Checks that a package-info.java file exists for each package. --> |
| 49 | + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage --> |
| 50 | + <!-- <module name="JavadocPackage"> --> |
| 51 | + <!-- <property name="allowLegacy" value="true"/> --><!-- Allow package.html in addition to package-info.java --> |
| 52 | + <!-- </module> --> |
| 53 | + |
| 54 | + <!-- Checks whether files end with a new line. --> |
| 55 | + <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> |
| 56 | + <!--<module name="NewlineAtEndOfFile"/>--> |
| 57 | + |
| 58 | + <!-- Checks that property files contain the same keys. --> |
| 59 | + <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> |
| 60 | + <module name="Translation"/> |
| 61 | + |
| 62 | + <!-- Checks for Size Violations. --> |
| 63 | + <!-- See http://checkstyle.sf.net/config_sizes.html --> |
| 64 | + <module name="FileLength"> |
| 65 | + <property name="max" value="3500"/> |
| 66 | + </module> |
| 67 | + |
| 68 | + <!-- Checks for whitespace --> |
| 69 | + <!-- See http://checkstyle.sf.net/config_whitespace.html --> |
| 70 | + <!--<module name="FileTabCharacter"/>--> |
| 71 | + |
| 72 | + <!-- Miscellaneous other checks. --> |
| 73 | + <!-- See http://checkstyle.sf.net/config_misc.html --> |
| 74 | + <module name="RegexpSingleline"> |
| 75 | + <property name="format" value="\s+$"/> |
| 76 | + <property name="minimum" value="0"/> |
| 77 | + <property name="maximum" value="0"/> |
| 78 | + <property name="message" value="Line has trailing spaces."/> |
| 79 | + </module> |
| 80 | + |
| 81 | + <!-- Checks for Headers --> |
| 82 | + <!-- See http://checkstyle.sf.net/config_header.html --> |
| 83 | + <!-- <module name="Header"> --> |
| 84 | + <!-- <property name="headerFile" value="${checkstyle.header.file}"/> --> |
| 85 | + <!-- <property name="fileExtensions" value="java"/> --> |
| 86 | + <!-- </module> --> |
| 87 | + |
| 88 | + <module name="TreeWalker"> |
| 89 | + |
| 90 | + <!-- Part of turning off indivial checks: --> |
| 91 | + <!-- http://stackoverflow.com/questions/5761188/checkstyle-suppressioncommentfilter-not-ignoring-specified-rule/5764666#5764666 --> |
| 92 | + <module name="FileContentsHolder"/> |
| 93 | + <module name="SuppressWarningsHolder" /> |
| 94 | + |
| 95 | + <!-- Checks for Javadoc comments. --> |
| 96 | + <!-- See http://checkstyle.sf.net/config_javadoc.html --> |
| 97 | + <!--<module name="JavadocMethod"/> This is just too whiny for now. --> |
| 98 | + <!-- <module name="JavadocType"/> --> |
| 99 | + <!-- |
| 100 | + <module name="JavadocVariable"> |
| 101 | + <property name="scope" value="package"/> |
| 102 | + </module> |
| 103 | + --> |
| 104 | + <module name="JavadocStyle"/> |
| 105 | + |
| 106 | + |
| 107 | + <!-- Checks for Naming Conventions. --> |
| 108 | + <!-- See http://checkstyle.sf.net/config_naming.html --> |
| 109 | + <module name="ConstantName" /> |
| 110 | + <module name="LocalFinalVariableName" /> |
| 111 | + <module name="LocalVariableName" /> |
| 112 | + <module name="MemberName" /> |
| 113 | + <module name="MethodName"/> |
| 114 | + <module name="PackageName"/> |
| 115 | + <module name="ParameterName" /> |
| 116 | + <module name="StaticVariableName" /> |
| 117 | + <module name="TypeName"/> |
| 118 | + |
| 119 | + |
| 120 | + <!-- Checks for imports --> |
| 121 | + <!-- See http://checkstyle.sf.net/config_import.html --> |
| 122 | + <module name="AvoidStarImport"/> |
| 123 | + <module name="IllegalImport"/> |
| 124 | + <module name="RedundantImport"/> |
| 125 | + <module name="UnusedImports"/> |
| 126 | + |
| 127 | + |
| 128 | + <!-- Checks for Size Violations. --> |
| 129 | + <!-- See http://checkstyle.sf.net/config_sizes.html --> |
| 130 | + <!-- TODO: lower this value --> |
| 131 | + <module name="LineLength"> |
| 132 | + <property name="max" value="300"/> |
| 133 | + </module> |
| 134 | + <!-- <module name="MethodLength"> |
| 135 | + <property name="max" value="300"/> |
| 136 | + </module> --> |
| 137 | + <!-- <module name="ParameterNumber"> |
| 138 | + <property name="max" value="9"/> |
| 139 | + <property name="ignoreOverriddenMethods" value="true"/> |
| 140 | + </module> --> |
| 141 | + |
| 142 | + |
| 143 | + <!-- Checks for whitespace --> |
| 144 | + <!-- See http://checkstyle.sf.net/config_whitespace.html --> |
| 145 | + <module name="EmptyForIteratorPad"/> |
| 146 | + <module name="GenericWhitespace"/> |
| 147 | + <module name="MethodParamPad"/> |
| 148 | + <module name="NoWhitespaceAfter"/> |
| 149 | + <module name="NoWhitespaceBefore"/> |
| 150 | + <module name="OperatorWrap" /> |
| 151 | + <module name="ParenPad"/> |
| 152 | + <module name="TypecastParenPad"/> |
| 153 | + <module name="WhitespaceAround"/> |
| 154 | + |
| 155 | + |
| 156 | + <!-- Modifier Checks --> |
| 157 | + <!-- See http://checkstyle.sf.net/config_modifiers.html --> |
| 158 | + <module name="ModifierOrder"/> |
| 159 | + <module name="RedundantModifier"/> |
| 160 | + |
| 161 | + |
| 162 | + <!-- Checks for blocks. You know, those {}'s --> |
| 163 | + <!-- See http://checkstyle.sf.net/config_blocks.html --> |
| 164 | + <module name="AvoidNestedBlocks"/> |
| 165 | + <module name="EmptyBlock"/> |
| 166 | + <module name="LeftCurly"/> |
| 167 | + <module name="NeedBraces"> <!-- Allow stuff like "while (doSomething(minus-minus-count));" --> |
| 168 | + <!-- <property name="allowEmptyLoopBody" value="true"/> --> |
| 169 | + </module> |
| 170 | + <module name="RightCurly"> <!-- Right curlies should be alone in if/else --> |
| 171 | + <property name="option" value="alone"/> |
| 172 | + <property name="tokens" value="LITERAL_ELSE, METHOD_DEF"/> |
| 173 | + </module> |
| 174 | + |
| 175 | + <!-- Checks for common coding problems --> |
| 176 | + <!-- See http://checkstyle.sf.net/config_coding.html --> |
| 177 | + <!--<module name="AvoidInlineConditionals"/>--> |
| 178 | + <module name="DefaultComesLast"/> |
| 179 | + <module name="DeclarationOrder"/> |
| 180 | + <module name="CovariantEquals"/> |
| 181 | + <module name="EmptyStatement"/> |
| 182 | + <module name="EqualsHashCode"/> |
| 183 | + <module name="EqualsAvoidNull"/> |
| 184 | + <!-- Completely overridden since it's common in Java to do e.g. this.foo = foo; |
| 185 | + <module name="HiddenField"> |
| 186 | + <property name="ignoreSetter" value="true" /> |
| 187 | + <property name="ignoreConstructorParameter" value="true" /> |
| 188 | + </module> |
| 189 | + --> |
| 190 | + <module name="IllegalInstantiation"/> |
| 191 | + <!--<module name="InnerAssignment"/> --> |
| 192 | + <!--<module name="MagicNumber"/> --> |
| 193 | + <!--<module name="MissingSwitchDefault"/>--> |
| 194 | + <module name="SimplifyBooleanExpression"/> |
| 195 | + <module name="SimplifyBooleanReturn"/> |
| 196 | + <module name="OneStatementPerLine"/> |
| 197 | + <module name="OverloadMethodsDeclarationOrder"/> |
| 198 | + <module name="PackageDeclaration"/> |
| 199 | + <!-- TODO: lower this value --> |
| 200 | + <module name="ReturnCount"> |
| 201 | + <property name="max" value="6"/> |
| 202 | + </module> |
| 203 | + <module name="StringLiteralEquality"/> |
| 204 | + <module name="VariableDeclarationUsageDistance"> |
| 205 | + <!-- <property name="allowedDistance" value="7"/> --> |
| 206 | + <!-- NOTE: flexible on this value --> |
| 207 | + <property name="allowedDistance" value="5"/> |
| 208 | + </module> |
| 209 | + <!-- <module name="UnnecessaryParentheses"/> --> |
| 210 | + |
| 211 | + <!-- Checks for class design --> |
| 212 | + <!-- See http://checkstyle.sf.net/config_design.html --> |
| 213 | + <!--<module name="DesignForExtension"/>--> |
| 214 | + <module name="FinalClass"/> |
| 215 | + <module name="HideUtilityClassConstructor"/> |
| 216 | + <!--Allow constant interfaces --> |
| 217 | + <!-- <module name="InterfaceIsType"/> --> |
| 218 | + <module name="VisibilityModifier"> |
| 219 | + <property name="protectedAllowed" value="true"/> |
| 220 | + <property name="packageAllowed" value="true"/> |
| 221 | + </module> |
| 222 | + |
| 223 | + |
| 224 | + <!-- Miscellaneous other checks. --> |
| 225 | + <!-- See http://checkstyle.sf.net/config_misc.html --> |
| 226 | + <module name="ArrayTypeStyle"/> |
| 227 | + <module name="OuterTypeFilename"/> |
| 228 | + <!--<module name="FinalParameters"/>--> |
| 229 | + <module name="TodoComment"/> |
| 230 | + <module name="UpperEll"/> |
| 231 | + </module> |
| 232 | + |
| 233 | + <module name="Translation" /> |
| 234 | + |
| 235 | + <module name="SuppressionFilter"> |
| 236 | + <property name="file" value="config/checkstyle/torgoSuppressions.xml"/> |
| 237 | + </module> |
| 238 | + <module name="SuppressionCommentFilter" /> |
| 239 | + <module name="SuppressWithNearbyCommentFilter" /> |
| 240 | +</module> |
0 commit comments