| 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 | <!-- Checks that a package.html file exists for each package. --> |
|---|
| 36 | <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> |
|---|
| 37 | <module name="PackageHtml"/> |
|---|
| 38 | |
|---|
| 39 | <!-- Checks whether files end with a new line. --> |
|---|
| 40 | <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> |
|---|
| 41 | <module name="NewlineAtEndOfFile"/> |
|---|
| 42 | |
|---|
| 43 | <!-- Checks that property files contain the same keys. --> |
|---|
| 44 | <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> |
|---|
| 45 | <module name="Translation"/> |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | <module name="TreeWalker"> |
|---|
| 49 | |
|---|
| 50 | <!-- Checks for Javadoc comments. --> |
|---|
| 51 | <!-- See http://checkstyle.sf.net/config_javadoc.html --> |
|---|
| 52 | <module name="JavadocMethod"/> |
|---|
| 53 | <module name="JavadocType"/> |
|---|
| 54 | <module name="JavadocVariable"/> |
|---|
| 55 | <module name="JavadocStyle"/> |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | <!-- Checks for Naming Conventions. --> |
|---|
| 59 | <!-- See http://checkstyle.sf.net/config_naming.html --> |
|---|
| 60 | <module name="ConstantName"/> |
|---|
| 61 | <module name="LocalFinalVariableName"/> |
|---|
| 62 | <module name="LocalVariableName"/> |
|---|
| 63 | <module name="MemberName"/> |
|---|
| 64 | <module name="MethodName"/> |
|---|
| 65 | <module name="PackageName"/> |
|---|
| 66 | <module name="ParameterName"/> |
|---|
| 67 | <module name="StaticVariableName"/> |
|---|
| 68 | <module name="TypeName"/> |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | <!-- Checks for Headers --> |
|---|
| 72 | <!-- See http://checkstyle.sf.net/config_header.html --> |
|---|
| 73 | <!-- <module name="Header"> --> |
|---|
| 74 | <!-- The follow property value demonstrates the ability --> |
|---|
| 75 | <!-- to have access to ANT properties. In this case it uses --> |
|---|
| 76 | <!-- the ${basedir} property to allow Checkstyle to be run --> |
|---|
| 77 | <!-- from any directory within a project. See property --> |
|---|
| 78 | <!-- expansion, --> |
|---|
| 79 | <!-- http://checkstyle.sf.net/config.html#properties --> |
|---|
| 80 | <!-- <property --> |
|---|
| 81 | <!-- name="headerFile" --> |
|---|
| 82 | <!-- value="${basedir}/java.header"/> --> |
|---|
| 83 | <!-- </module> --> |
|---|
| 84 | |
|---|
| 85 | <!-- Following interprets the header file as regular expressions. --> |
|---|
| 86 | <!-- <module name="RegexpHeader"/> --> |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | <!-- Checks for imports --> |
|---|
| 90 | <!-- See http://checkstyle.sf.net/config_import.html --> |
|---|
| 91 | <module name="AvoidStarImport"/> |
|---|
| 92 | <module name="IllegalImport"/> <!-- defaults to sun.* packages --> |
|---|
| 93 | <module name="RedundantImport"/> |
|---|
| 94 | <module name="UnusedImports"/> |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | <!-- Checks for Size Violations. --> |
|---|
| 98 | <!-- See http://checkstyle.sf.net/config_sizes.html --> |
|---|
| 99 | <module name="FileLength"/> |
|---|
| 100 | <module name="LineLength"/> |
|---|
| 101 | <module name="MethodLength"/> |
|---|
| 102 | <module name="ParameterNumber"/> |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | <!-- Checks for whitespace --> |
|---|
| 106 | <!-- See http://checkstyle.sf.net/config_whitespace.html --> |
|---|
| 107 | <module name="EmptyForIteratorPad"/> |
|---|
| 108 | <module name="MethodParamPad"/> |
|---|
| 109 | <module name="NoWhitespaceAfter"/> |
|---|
| 110 | <module name="NoWhitespaceBefore"/> |
|---|
| 111 | <module name="OperatorWrap"/> |
|---|
| 112 | <module name="ParenPad"/> |
|---|
| 113 | <module name="TypecastParenPad"/> |
|---|
| 114 | <module name="TabCharacter"/> |
|---|
| 115 | <module name="WhitespaceAfter"/> |
|---|
| 116 | <module name="WhitespaceAround"/> |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | <!-- Modifier Checks --> |
|---|
| 120 | <!-- See http://checkstyle.sf.net/config_modifiers.html --> |
|---|
| 121 | <module name="ModifierOrder"/> |
|---|
| 122 | <module name="RedundantModifier"/> |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | <!-- Checks for blocks. You know, those {}'s --> |
|---|
| 126 | <!-- See http://checkstyle.sf.net/config_blocks.html --> |
|---|
| 127 | <module name="AvoidNestedBlocks"/> |
|---|
| 128 | <module name="EmptyBlock"/> |
|---|
| 129 | <module name="LeftCurly"/> |
|---|
| 130 | <module name="NeedBraces"/> |
|---|
| 131 | <module name="RightCurly"/> |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | <!-- Checks for common coding problems --> |
|---|
| 135 | <!-- See http://checkstyle.sf.net/config_coding.html --> |
|---|
| 136 | <module name="AvoidInlineConditionals"/> |
|---|
| 137 | <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE --> |
|---|
| 138 | <module name="EmptyStatement"/> |
|---|
| 139 | <module name="EqualsHashCode"/> |
|---|
| 140 | <module name="HiddenField"/> |
|---|
| 141 | <module name="IllegalInstantiation"/> |
|---|
| 142 | <module name="InnerAssignment"/> |
|---|
| 143 | <module name="MagicNumber"/> |
|---|
| 144 | <module name="MissingSwitchDefault"/> |
|---|
| 145 | <module name="RedundantThrows"/> |
|---|
| 146 | <module name="SimplifyBooleanExpression"/> |
|---|
| 147 | <module name="SimplifyBooleanReturn"/> |
|---|
| 148 | |
|---|
| 149 | <!-- Checks for class design --> |
|---|
| 150 | <!-- See http://checkstyle.sf.net/config_design.html --> |
|---|
| 151 | <module name="DesignForExtension"/> |
|---|
| 152 | <module name="FinalClass"/> |
|---|
| 153 | <module name="HideUtilityClassConstructor"/> |
|---|
| 154 | <module name="InterfaceIsType"/> |
|---|
| 155 | <module name="VisibilityModifier"/> |
|---|
| 156 | |
|---|
| 157 | |
|---|
| 158 | <!-- Miscellaneous other checks. --> |
|---|
| 159 | <!-- See http://checkstyle.sf.net/config_misc.html --> |
|---|
| 160 | <module name="ArrayTypeStyle"/> |
|---|
| 161 | <module name="FinalParameters"/> |
|---|
| 162 | <module name="GenericIllegalRegexp"> |
|---|
| 163 | <property name="format" value="\s+$"/> |
|---|
| 164 | <property name="message" value="Line has trailing spaces."/> |
|---|
| 165 | </module> |
|---|
| 166 | <module name="TodoComment"/> |
|---|
| 167 | <module name="UpperEll"/> |
|---|
| 168 | |
|---|
| 169 | </module> |
|---|
| 170 | |
|---|
| 171 | </module> |
|---|