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