|
| 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 | +<!-- |
| 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 | +<!-- |
| 43 | + <module name="SuppressionFilter"> |
| 44 | + <property name="file" value="suppressions.xml"/> |
| 45 | + </module> |
| 46 | +--> |
| 47 | + |
| 48 | + <!-- Checks that each Java package has a Javadoc file used for commenting. --> |
| 49 | + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage |
| 50 | + <module name="JavadocPackage"> |
| 51 | + <property name="allowLegacy" value="true"/> |
| 52 | + </module> |
| 53 | + --> |
| 54 | + |
| 55 | + <!-- Checks whether files end with a new line. --> |
| 56 | + <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> |
| 57 | + <module name="NewlineAtEndOfFile"/> |
| 58 | + |
| 59 | + <!-- Checks that property files contain the same keys. --> |
| 60 | + <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> |
| 61 | + <module name="Translation"/> |
| 62 | + |
| 63 | + <module name="FileLength"/> |
| 64 | + |
| 65 | + <!-- Following interprets the header file as regular expressions. --> |
| 66 | + <!-- <module name="RegexpHeader"/> --> |
| 67 | + |
| 68 | + <module name="FileTabCharacter"> |
| 69 | + <property name="eachLine" value="true"/> |
| 70 | + </module> |
| 71 | + |
| 72 | + <!-- \s matches whitespace character, $ matches end of line. |
| 73 | + <module name="RegexpSingleline"> |
| 74 | + <property name="format" value="\s+$"/> |
| 75 | + <property name="message" value="Line has trailing spaces."/> |
| 76 | + </module> |
| 77 | + --> |
| 78 | + |
| 79 | + <module name="TreeWalker"> |
| 80 | + |
| 81 | + <property name="cacheFile" value="${checkstyle.cache.file}"/> |
| 82 | + |
| 83 | + <!-- Checks for Javadoc comments. --> |
| 84 | + <!-- See http://checkstyle.sf.net/config_javadoc.html --> |
| 85 | + <module name="JavadocMethod"> |
| 86 | + <property name="scope" value="public"/> |
| 87 | + </module> |
| 88 | + <module name="JavadocType"> |
| 89 | + <property name="scope" value="public"/> |
| 90 | + </module> |
| 91 | + <module name="JavadocVariable"> |
| 92 | + <property name="scope" value="public"/> |
| 93 | + </module> |
| 94 | + <module name="JavadocStyle"> |
| 95 | + <property name="scope" value="public"/> |
| 96 | + <property name="checkHtml" value="false"/> |
| 97 | + </module> |
| 98 | + |
| 99 | + |
| 100 | + <!-- Checks for Naming Conventions. --> |
| 101 | + <!-- See http://checkstyle.sf.net/config_naming.html --> |
| 102 | + <module name="ConstantName"/> |
| 103 | + <module name="LocalFinalVariableName"> |
| 104 | + <property name="format" value="^[a-z_][a-zA-Z0-9_]*$"/> |
| 105 | + </module> |
| 106 | + <module name="LocalVariableName"> |
| 107 | + <property name="format" value="^[a-z_][a-zA-Z0-9_]*$"/> |
| 108 | + </module> |
| 109 | + <module name="MemberName"> |
| 110 | + <property name="format" value="^_[a-z_][a-zA-Z0-9_]*$"/> |
| 111 | + </module> |
| 112 | + <module name="MethodName"> |
| 113 | + <property name="format" value="^[a-z_][a-zA-Z0-9_]*$"/> |
| 114 | + </module> |
| 115 | + <module name="PackageName"/> |
| 116 | + <module name="ParameterName"> |
| 117 | + <property name="format" value="^[a-z_][a-zA-Z0-9_]*$"/> |
| 118 | + </module> |
| 119 | + <module name="TypeName"/> |
| 120 | + |
| 121 | + |
| 122 | + <!-- Checks for Headers --> |
| 123 | + <!-- See http://checkstyle.sf.net/config_header.html --> |
| 124 | + <!-- <module name="Header"> --> |
| 125 | + <!-- The follow property value demonstrates the ability --> |
| 126 | + <!-- to have access to ANT properties. In this case it uses --> |
| 127 | + <!-- the ${basedir} property to allow Checkstyle to be run --> |
| 128 | + <!-- from any directory within a project. See property --> |
| 129 | + <!-- expansion, --> |
| 130 | + <!-- http://checkstyle.sf.net/config.html#properties --> |
| 131 | + <!-- <property --> |
| 132 | + <!-- name="headerFile" --> |
| 133 | + <!-- value="${basedir}/java.header"/> --> |
| 134 | + <!-- </module> --> |
| 135 | + |
| 136 | + |
| 137 | + <!-- Checks for imports --> |
| 138 | + <!-- See http://checkstyle.sf.net/config_import.html --> |
| 139 | + <module name="AvoidStarImport"/> |
| 140 | + <module name="IllegalImport"/> <!-- defaults to sun.* packages --> |
| 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"/>--> |
| 148 | + <module name="MethodLength"/> |
| 149 | + <module name="ParameterNumber"/> |
| 150 | + |
| 151 | + |
| 152 | + <!-- Checks for whitespace --> |
| 153 | + <!-- See http://checkstyle.sf.net/config_whitespace.html --> |
| 154 | + <module name="EmptyForIteratorPad"/> |
| 155 | + <module name="MethodParamPad"/> |
| 156 | + <module name="NoWhitespaceAfter"/> |
| 157 | + <module name="NoWhitespaceBefore"/> |
| 158 | + <module name="OperatorWrap"/> |
| 159 | + <module name="ParenPad"/> |
| 160 | + <!--<module name="TypecastParenPad"/>--> |
| 161 | + <module name="WhitespaceAfter"> |
| 162 | + <property name="tokens" value="SEMI"/> |
| 163 | + </module> |
| 164 | + <module name="WhitespaceAround"> |
| 165 | + <property name="allowEmptyConstructors" value="true"/> |
| 166 | + <property name="tokens" value="BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV_ASSIGN,EQUAL,GE,LAND,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS_ASSIGN,QUESTION,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,TYPE_EXTENSION_AND"/> |
| 167 | + </module> |
| 168 | + |
| 169 | + |
| 170 | + <!-- Modifier Checks --> |
| 171 | + <!-- See http://checkstyle.sf.net/config_modifiers.html --> |
| 172 | + <!--<module name="ModifierOrder"/>--> |
| 173 | + <!--<module name="RedundantModifier"/>--> |
| 174 | + |
| 175 | + |
| 176 | + <!-- Checks for blocks. You know, those {}'s --> |
| 177 | + <!-- See http://checkstyle.sf.net/config_blocks.html --> |
| 178 | + <module name="AvoidNestedBlocks"/> |
| 179 | + <module name="EmptyBlock"/> |
| 180 | + <module name="LeftCurly"/> |
| 181 | + <module name="NeedBraces"/> |
| 182 | + <module name="RightCurly"/> |
| 183 | + |
| 184 | + |
| 185 | + <!-- Checks for common coding problems --> |
| 186 | + <!-- See http://checkstyle.sf.net/config_coding.html --> |
| 187 | + <!--<module name="AvoidInlineConditionals"/>--> |
| 188 | + <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE --> |
| 189 | + <module name="EmptyStatement"/> |
| 190 | + <module name="EqualsHashCode"/> |
| 191 | + <module name="HiddenField"/> |
| 192 | + <module name="IllegalInstantiation"/> |
| 193 | + <module name="InnerAssignment"/> |
| 194 | + <!--<module name="MagicNumber"/>--> |
| 195 | + <!--<module name="MissingSwitchDefault"/>--> |
| 196 | + <!--<module name="RedundantThrows"/> --> |
| 197 | + <module name="SimplifyBooleanExpression"/> |
| 198 | + <module name="SimplifyBooleanReturn"/> |
| 199 | + |
| 200 | + <!-- Checks for class design --> |
| 201 | + <!-- See http://checkstyle.sf.net/config_design.html --> |
| 202 | + <!--<module name="DesignForExtension"/>--> |
| 203 | + <module name="FinalClass"/> |
| 204 | + <module name="HideUtilityClassConstructor"/> |
| 205 | + <!--<module name="InterfaceIsType"/>--> |
| 206 | + <module name="VisibilityModifier"/> |
| 207 | + |
| 208 | + |
| 209 | + <!-- Miscellaneous other checks. --> |
| 210 | + <!-- See http://checkstyle.sf.net/config_misc.html --> |
| 211 | + <module name="ArrayTypeStyle"/> |
| 212 | + <!--<module name="FinalParameters"/>--> |
| 213 | + <!--<module name="TodoComment"/>--> |
| 214 | + <module name="UpperEll"/> |
| 215 | + |
| 216 | + </module> |
| 217 | + |
| 218 | +</module> |
0 commit comments