| 1 | <?xml version="1.0"?> |
|---|
| 2 | <!DOCTYPE module PUBLIC |
|---|
| 3 | "-//Puppy Crawl//DTD Check Configuration 1.2//EN" |
|---|
| 4 | "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> |
|---|
| 5 | |
|---|
| 6 | <!-- Taken from checkstyle 4.2 |
|---|
| 7 | See additionally added checkers at the end of the file --> |
|---|
| 8 | |
|---|
| 9 | <!-- |
|---|
| 10 | |
|---|
| 11 | Checkstyle configuration that checks the sun coding conventions from: |
|---|
| 12 | |
|---|
| 13 | - the Java Language Specification at |
|---|
| 14 | http://java.sun.com/docs/books/jls/second_edition/html/index.html |
|---|
| 15 | |
|---|
| 16 | - the Sun Code Conventions at http://java.sun.com/docs/codeconv/ |
|---|
| 17 | |
|---|
| 18 | - the Javadoc guidelines at |
|---|
| 19 | http://java.sun.com/j2se/javadoc/writingdoccomments/index.html |
|---|
| 20 | |
|---|
| 21 | - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html |
|---|
| 22 | |
|---|
| 23 | - some best practices |
|---|
| 24 | |
|---|
| 25 | Checkstyle is very configurable. Be sure to read the documentation at |
|---|
| 26 | http://checkstyle.sf.net (or in your downloaded distribution). |
|---|
| 27 | |
|---|
| 28 | Most Checks are configurable, be sure to consult the documentation. |
|---|
| 29 | |
|---|
| 30 | To completely disable a check, just comment it out or delete it from the file. |
|---|
| 31 | |
|---|
| 32 | Finally, it is worth reading the documentation. |
|---|
| 33 | |
|---|
| 34 | --> |
|---|
| 35 | |
|---|
| 36 | <module name="Checker"> |
|---|
| 37 | |
|---|
| 38 | <!-- Checks that a package.html file exists for each package. --> |
|---|
| 39 | <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> |
|---|
| 40 | <module name="PackageHtml"/> |
|---|
| 41 | |
|---|
| 42 | <!-- Checks whether files end with a new line. --> |
|---|
| 43 | <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> |
|---|
| 44 | <module name="NewlineAtEndOfFile"/> |
|---|
| 45 | |
|---|
| 46 | <!-- Checks that property files contain the same keys. --> |
|---|
| 47 | <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> |
|---|
| 48 | <module name="Translation"/> |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | <module name="TreeWalker"> |
|---|
| 52 | |
|---|
| 53 | <!-- Checks for Javadoc comments. --> |
|---|
| 54 | <!-- See http://checkstyle.sf.net/config_javadoc.html --> |
|---|
| 55 | <module name="JavadocMethod"> |
|---|
| 56 | <!-- AM: Decreased scope, was checkstyle default --> |
|---|
| 57 | <property name="scope" value="public"/> |
|---|
| 58 | </module> |
|---|
| 59 | <module name="JavadocType"> |
|---|
| 60 | <!-- AM: Decreased scope, was checkstyle default --> |
|---|
| 61 | <property name="scope" value="public"/> |
|---|
| 62 | </module> |
|---|
| 63 | <module name="JavadocVariable"> |
|---|
| 64 | <!-- AM: Decreased scope, was checkstyle default --> |
|---|
| 65 | <property name="scope" value="public"/> |
|---|
| 66 | </module> |
|---|
| 67 | <module name="JavadocStyle"> |
|---|
| 68 | <!-- AM: Decreased scope, was checkstyle default --> |
|---|
| 69 | <property name="scope" value="public"/> |
|---|
| 70 | </module> |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | <!-- Checks for Naming Conventions. --> |
|---|
| 74 | <!-- See http://checkstyle.sf.net/config_naming.html --> |
|---|
| 75 | <module name="ConstantName"/> |
|---|
| 76 | <module name="LocalFinalVariableName"/> |
|---|
| 77 | <module name="LocalVariableName"/> |
|---|
| 78 | <module name="MemberName"/> |
|---|
| 79 | <module name="MethodName"/> |
|---|
| 80 | <module name="PackageName"/> |
|---|
| 81 | <module name="ParameterName"/> |
|---|
| 82 | <module name="StaticVariableName"/> |
|---|
| 83 | <module name="TypeName"/> |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | <!-- Checks for Headers --> |
|---|
| 87 | <!-- See http://checkstyle.sf.net/config_header.html --> |
|---|
| 88 | <!-- <module name="Header"> --> |
|---|
| 89 | <!-- The follow property value demonstrates the ability --> |
|---|
| 90 | <!-- to have access to ANT properties. In this case it uses --> |
|---|
| 91 | <!-- the ${basedir} property to allow Checkstyle to be run --> |
|---|
| 92 | <!-- from any directory within a project. See property --> |
|---|
| 93 | <!-- expansion, --> |
|---|
| 94 | <!-- http://checkstyle.sf.net/config.html#properties --> |
|---|
| 95 | <!-- <property --> |
|---|
| 96 | <!-- name="headerFile" --> |
|---|
| 97 | <!-- value="${basedir}/java.header"/> --> |
|---|
| 98 | <!-- </module> --> |
|---|
| 99 | |
|---|
| 100 | <!-- Following interprets the header file as regular expressions. --> |
|---|
| 101 | <!-- <module name="RegexpHeader"/> --> |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | <!-- Checks for imports --> |
|---|
| 105 | <!-- See http://checkstyle.sf.net/config_import.html --> |
|---|
| 106 | <!-- <module name="AvoidStarImport"/> Could not find this in SUN Conventions. --> |
|---|
| 107 | <module name="IllegalImport"/> <!-- defaults to sun.* packages --> |
|---|
| 108 | <module name="RedundantImport"/> |
|---|
| 109 | <module name="UnusedImports"/> |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | <!-- Checks for Size Violations. --> |
|---|
| 113 | <!-- See http://checkstyle.sf.net/config_sizes.html --> |
|---|
| 114 | <module name="FileLength"/> |
|---|
| 115 | <module name="LineLength"/> |
|---|
| 116 | <module name="MethodLength"/> |
|---|
| 117 | <module name="ParameterNumber"/> |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 120 | <!-- Checks for whitespace --> |
|---|
| 121 | <!-- See http://checkstyle.sf.net/config_whitespace.html --> |
|---|
| 122 | <module name="EmptyForIteratorPad"/> |
|---|
| 123 | <module name="MethodParamPad"/> |
|---|
| 124 | <module name="NoWhitespaceAfter"/> |
|---|
| 125 | <module name="NoWhitespaceBefore"/> |
|---|
| 126 | <module name="OperatorWrap"/> |
|---|
| 127 | <module name="ParenPad"/> |
|---|
| 128 | <module name="TypecastParenPad"/> |
|---|
| 129 | <!-- <module name="TabCharacter"/> AM: Not limited by Sun! --> |
|---|
| 130 | <module name="WhitespaceAfter"/> |
|---|
| 131 | <module name="WhitespaceAround"/> |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | <!-- Modifier Checks --> |
|---|
| 135 | <!-- See http://checkstyle.sf.net/config_modifiers.html --> |
|---|
| 136 | <module name="ModifierOrder"/> |
|---|
| 137 | <module name="RedundantModifier"/> |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | <!-- Checks for blocks. You know, those {}'s --> |
|---|
| 141 | <!-- See http://checkstyle.sf.net/config_blocks.html --> |
|---|
| 142 | <module name="AvoidNestedBlocks"/> |
|---|
| 143 | <!-- <module name="EmptyBlock"/> AM: might contain comment... --> |
|---|
| 144 | <module name="LeftCurly"/> |
|---|
| 145 | <module name="NeedBraces"/> |
|---|
| 146 | <module name="RightCurly"/> |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | <!-- Checks for common coding problems --> |
|---|
| 150 | <!-- See http://checkstyle.sf.net/config_coding.html --> |
|---|
| 151 | <module name="AvoidInlineConditionals"/> |
|---|
| 152 | <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE --> |
|---|
| 153 | <module name="EmptyStatement"/> |
|---|
| 154 | <!-- <module name="EqualsHashCode"/> Covered by PMD --> |
|---|
| 155 | <module name="HiddenField"/> |
|---|
| 156 | <module name="IllegalInstantiation"/> |
|---|
| 157 | <module name="InnerAssignment"/> |
|---|
| 158 | <module name="MagicNumber"/> |
|---|
| 159 | <module name="MissingSwitchDefault"/> |
|---|
| 160 | <!-- <module name="RedundantThrows"/> AM: ok to throw runtime exceptions --> |
|---|
| 161 | <module name="SimplifyBooleanExpression"/> |
|---|
| 162 | <module name="SimplifyBooleanReturn"/> |
|---|
| 163 | |
|---|
| 164 | <!-- Checks for class design --> |
|---|
| 165 | <!-- See http://checkstyle.sf.net/config_design.html --> |
|---|
| 166 | <!-- AM: disabled <module name="DesignForExtension"/> --> |
|---|
| 167 | <module name="FinalClass"/> |
|---|
| 168 | <module name="HideUtilityClassConstructor"/> |
|---|
| 169 | <module name="InterfaceIsType"/> |
|---|
| 170 | <module name="VisibilityModifier"/> |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | <!-- Miscellaneous other checks. --> |
|---|
| 174 | <!-- See http://checkstyle.sf.net/config_misc.html --> |
|---|
| 175 | <module name="ArrayTypeStyle"/> |
|---|
| 176 | <!-- AM: Disabled <module name="FinalParameters"/> --> |
|---|
| 177 | <!-- AM: Disabled <module name="GenericIllegalRegexp"> |
|---|
| 178 | <property name="format" value="\s+$"/> |
|---|
| 179 | <property name="message" value="Line has trailing spaces."/> |
|---|
| 180 | </module> --> |
|---|
| 181 | <module name="TodoComment"/> |
|---|
| 182 | <module name="UpperEll"/> |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | <!-- Added by AM, to enable problem checks --> |
|---|
| 186 | <!-- Checks that classes that define a covariant equals() method also |
|---|
| 187 | override method equals(java.lang.Object). --> |
|---|
| 188 | <module name="CovariantEquals"> |
|---|
| 189 | <property name="severity" value="error"/> |
|---|
| 190 | </module> |
|---|
| 191 | |
|---|
| 192 | <!-- Checks that local variables that never have their values |
|---|
| 193 | changed are declared final. --> |
|---|
| 194 | <module name="FinalLocalVariable"> |
|---|
| 195 | <property name="severity" value="info"/> |
|---|
| 196 | </module> |
|---|
| 197 | |
|---|
| 198 | <!-- Checks that string literals are not used with == or !=. --> |
|---|
| 199 | <module name="StringLiteralEquality"> |
|---|
| 200 | <property name="severity" value="error"/> |
|---|
| 201 | </module> |
|---|
| 202 | |
|---|
| 203 | <!-- Checks that an overriding clone() method invokes super.clone(). --> |
|---|
| 204 | <module name="SuperClone"> |
|---|
| 205 | <property name="severity" value="error"/> |
|---|
| 206 | </module> |
|---|
| 207 | |
|---|
| 208 | <!-- Checks that an overriding finalize() method invokes super.finalize(). |
|---|
| 209 | --> |
|---|
| 210 | <module name="SuperFinalize"> |
|---|
| 211 | <property name="severity" value="error"/> |
|---|
| 212 | </module> |
|---|
| 213 | |
|---|
| 214 | <!-- Checks cyclomatic complexity against a specified limit. --> |
|---|
| 215 | <module name="CyclomaticComplexity"> |
|---|
| 216 | <property name="max" value="12"/> |
|---|
| 217 | <property name="severity" value="warning"/> |
|---|
| 218 | </module> |
|---|
| 219 | <module name="CyclomaticComplexity"> |
|---|
| 220 | <property name="max" value="20"/> |
|---|
| 221 | <property name="severity" value="error"/> |
|---|
| 222 | </module> |
|---|
| 223 | |
|---|
| 224 | </module> |
|---|
| 225 | |
|---|
| 226 | </module> |
|---|