checkstyle.xml
changeset 33 0e65d5f55d2f
parent 32 4d26854143e2
child 38 3e76846c48a9
equal deleted inserted replaced
32:4d26854143e2 33:0e65d5f55d2f
     5 
     5 
     6 <!--
     6 <!--
     7 
     7 
     8   Checkstyle configuration that checks the sun coding conventions from:
     8   Checkstyle configuration that checks the sun coding conventions from:
     9 
     9 
    10     - the Java Language Specification at
    10   - the Java Language Specification at
    11       http://java.sun.com/docs/books/jls/second_edition/html/index.html
    11   http://java.sun.com/docs/books/jls/second_edition/html/index.html
    12 
    12 
    13     - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
    13   - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
    14 
    14 
    15     - the Javadoc guidelines at
    15   - the Javadoc guidelines at
    16       http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
    16   http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
    17 
    17 
    18     - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
    18   - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
    19 
    19 
    20     - some best practices
    20   - some best practices
    21 
    21 
    22   Checkstyle is very configurable. Be sure to read the documentation at
    22   Checkstyle is very configurable. Be sure to read the documentation at
    23   http://checkstyle.sf.net (or in your downloaded distribution).
    23   http://checkstyle.sf.net (or in your downloaded distribution).
    24 
    24 
    25   Most Checks are configurable, be sure to consult the documentation.
    25   Most Checks are configurable, be sure to consult the documentation.
    45     <module name="Translation"/>
    45     <module name="Translation"/>
    46 
    46 
    47 
    47 
    48     <module name="TreeWalker">
    48     <module name="TreeWalker">
    49 
    49 
    50         <!-- Checks for Javadoc comments.                     -->
    50 	<!-- Checks for Javadoc comments.                     -->
    51         <!-- See http://checkstyle.sf.net/config_javadoc.html -->
    51 	<!-- See http://checkstyle.sf.net/config_javadoc.html -->
    52 	<module name="JavadocMethod"/>
    52 	<module name="JavadocMethod">
    53 	    <property name="allowUndeclaredRTE" value="true"/>
    53 	    <property name="allowUndeclaredRTE" value="true"/>
    54 	</module>
    54 	</module>
    55         <module name="JavadocType"/>
    55 	<module name="JavadocType"/>
    56         <module name="JavadocVariable"/>
    56 	<module name="JavadocVariable">
    57         <module name="JavadocStyle"/>
    57 	    <property name="scope" value="package" />
       
    58 	</module>
       
    59 	<module name="JavadocStyle">
    58 	    <property name="checkEmptyJavadoc" value="true"/>
    60 	    <property name="checkEmptyJavadoc" value="true"/>
    59 	</module>
    61 	</module>
    60 
    62 
    61 
    63 
    62         <!-- Checks for Naming Conventions.                  -->
    64 	<!-- Checks for Naming Conventions.                  -->
    63         <!-- See http://checkstyle.sf.net/config_naming.html -->
    65 	<!-- See http://checkstyle.sf.net/config_naming.html -->
    64         <module name="ConstantName"/>
    66 	<module name="ConstantName"/>
    65         <module name="LocalFinalVariableName"/>
    67 	<module name="LocalFinalVariableName"/>
    66         <module name="LocalVariableName"/>
    68 	<module name="LocalVariableName"/>
    67 	<module name="MemberName">
    69 	<module name="MemberName">
    68 	    <property  name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
    70 	    <property  name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
    69 	</module>
    71 	</module>
    70         <module name="MethodName"/>
    72 	<module name="MethodName"/>
    71         <module name="PackageName"/>
    73 	<module name="PackageName"/>
    72         <module name="ParameterName"/>
    74 	<module name="ParameterName"/>
    73         <module name="StaticVariableName"/>
    75 	<module name="StaticVariableName"/>
    74         <module name="TypeName"/>
    76 	<module name="TypeName"/>
    75 
    77 
    76 
    78 
    77         <!-- Checks for Headers                                -->
    79 	<!-- Checks for Headers                                -->
    78         <!-- See http://checkstyle.sf.net/config_header.html   -->
    80 	<!-- See http://checkstyle.sf.net/config_header.html   -->
    79         <!-- <module name="Header">                            -->
    81 	<!-- <module name="Header">                            -->
    80             <!-- The follow property value demonstrates the ability     -->
    82 	<!-- The follow property value demonstrates the ability     -->
    81             <!-- to have access to ANT properties. In this case it uses -->
    83 	<!-- to have access to ANT properties. In this case it uses -->
    82             <!-- the ${basedir} property to allow Checkstyle to be run  -->
    84 	<!-- the ${basedir} property to allow Checkstyle to be run  -->
    83             <!-- from any directory within a project. See property      -->
    85 	<!-- from any directory within a project. See property      -->
    84             <!-- expansion,                                             -->
    86 	<!-- expansion,                                             -->
    85             <!-- http://checkstyle.sf.net/config.html#properties        -->
    87 	<!-- http://checkstyle.sf.net/config.html#properties        -->
    86             <!-- <property                                              -->
    88 	<!-- <property                                              -->
    87             <!--     name="headerFile"                                  -->
    89 	<!--     name="headerFile"                                  -->
    88             <!--     value="${basedir}/java.header"/>                   -->
    90 	<!--     value="${basedir}/java.header"/>                   -->
    89         <!-- </module> -->
    91 	<!-- </module> -->
    90 
    92 
    91         <!-- Following interprets the header file as regular expressions. -->
    93 	<!-- Following interprets the header file as regular expressions. -->
    92         <!-- <module name="RegexpHeader"/>                                -->
    94 	<!-- <module name="RegexpHeader"/>                                -->
    93 
    95 
    94 
    96 
    95         <!-- Checks for imports                              -->
    97 	<!-- Checks for imports                              -->
    96         <!-- See http://checkstyle.sf.net/config_import.html -->
    98 	<!-- See http://checkstyle.sf.net/config_import.html -->
    97         <module name="AvoidStarImport"/>
    99 	<module name="AvoidStarImport"/>
    98         <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
   100 	<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
    99         <module name="RedundantImport"/>
   101 	<module name="RedundantImport"/>
   100         <module name="UnusedImports"/>
   102 	<module name="UnusedImports"/>
   101 
   103 
   102 
   104 
   103         <!-- Checks for Size Violations.                    -->
   105 	<!-- Checks for Size Violations.                    -->
   104         <!-- See http://checkstyle.sf.net/config_sizes.html -->
   106 	<!-- See http://checkstyle.sf.net/config_sizes.html -->
   105         <module name="FileLength"/>
   107 	<module name="FileLength"/>
   106 	<module name="LineLength">
   108 	<module name="LineLength">
   107 	    <property name="max" value="120" />
   109 	    <property name="max" value="120" />
   108 	</module>
   110 	</module>
   109         <module name="MethodLength"/>
   111 	<module name="MethodLength"/>
   110         <module name="ParameterNumber"/>
   112 	<module name="ParameterNumber"/>
   111 	<module name="AnonInnerLength">
   113 	<module name="AnonInnerLength">
   112 	    <property name="max" value="60" />
   114 	    <property name="max" value="60" />
   113 	</module>
   115 	</module>
   114 
   116 
   115 
   117 
   116         <!-- Checks for whitespace                               -->
   118 	<!-- Checks for whitespace                               -->
   117         <!-- See http://checkstyle.sf.net/config_whitespace.html -->
   119 	<!-- See http://checkstyle.sf.net/config_whitespace.html -->
   118         <module name="EmptyForIteratorPad"/>
   120 	<module name="EmptyForIteratorPad"/>
   119         <module name="MethodParamPad"/>
   121 	<module name="MethodParamPad"/>
   120         <module name="NoWhitespaceAfter"/>
   122 	<module name="NoWhitespaceAfter"/>
   121         <module name="NoWhitespaceBefore"/>
   123 	<module name="NoWhitespaceBefore"/>
   122         <module name="OperatorWrap"/>
   124 	<module name="OperatorWrap"/>
   123         <module name="ParenPad"/>
   125 	<module name="ParenPad"/>
   124         <module name="TypecastParenPad"/>
   126 	<module name="TypecastParenPad"/>
   125 	<!-- We want mixed tabulation
   127 	<!-- We want mixed tabulation
   126 	  <module name="TabCharacter"/> 
   128 	  <module name="TabCharacter"/> 
   127       -->
   129 	  -->
   128         <module name="WhitespaceAfter"/>
   130 	<module name="WhitespaceAfter"/>
   129         <module name="WhitespaceAround"/>
   131 	<module name="WhitespaceAround"/>
   130 
   132 
   131 
   133 
   132         <!-- Modifier Checks                                    -->
   134 	<!-- Modifier Checks                                    -->
   133         <!-- See http://checkstyle.sf.net/config_modifiers.html -->
   135 	<!-- See http://checkstyle.sf.net/config_modifiers.html -->
   134         <module name="ModifierOrder"/>
   136 	<module name="ModifierOrder"/>
   135         <module name="RedundantModifier"/>
   137 	<module name="RedundantModifier"/>
   136 
   138 
   137 
   139 
   138         <!-- Checks for blocks. You know, those {}'s         -->
   140 	<!-- Checks for blocks. You know, those {}'s         -->
   139         <!-- See http://checkstyle.sf.net/config_blocks.html -->
   141 	<!-- See http://checkstyle.sf.net/config_blocks.html -->
   140         <module name="AvoidNestedBlocks"/>
   142 	<module name="AvoidNestedBlocks"/>
   141         <module name="EmptyBlock"/>
   143 	<module name="EmptyBlock"/>
   142         <module name="LeftCurly"/>
   144 	<module name="LeftCurly"/>
   143 	<!--
   145 	<!--
   144 	  <module name="NeedBraces"/>
   146 	  <module name="NeedBraces"/>
   145 	  -->
   147 	  -->
   146         <module name="RightCurly"/>
   148 	<module name="RightCurly"/>
   147 
   149 
   148 
   150 
   149         <!-- Checks for common coding problems               -->
   151 	<!-- Checks for common coding problems               -->
   150         <!-- See http://checkstyle.sf.net/config_coding.html -->
   152 	<!-- See http://checkstyle.sf.net/config_coding.html -->
   151 	<module name="CovariantEquals"/>
   153 	<module name="CovariantEquals"/>
   152         <module name="AvoidInlineConditionals"/>
   154 	<module name="AvoidInlineConditionals"/>
   153 	<module name="InnerAssignment" />
   155 	<module name="InnerAssignment" />
   154         <module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
   156 	<module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
   155         <module name="EmptyStatement"/>
   157 	<module name="EmptyStatement"/>
   156         <module name="EqualsHashCode"/>
   158 	<module name="EqualsHashCode"/>
   157 	<module name="HiddenField">
   159 	<module name="HiddenField">
   158 	    <property name="ignoreConstructorParameter" value="true"/>
   160 	    <property name="ignoreConstructorParameter" value="true"/>
   159 	    <property name="ignoreAbstractMethods" value="true"/>
   161 	    <property name="ignoreAbstractMethods" value="true"/>
   160 	    <property name="ignoreSetter" value="true"/>
   162 	    <property name="ignoreSetter" value="true"/>
   161 	</module>
   163 	</module>
   162         <module name="IllegalInstantiation"/>
   164 	<module name="IllegalInstantiation"/>
   163         <module name="InnerAssignment"/>
   165 	<module name="InnerAssignment"/>
   164 	<!--
   166 	<!--
   165 	  <module name="MagicNumber"/>
   167 	  <module name="MagicNumber"/>
   166 	  -->
   168 	  -->
   167         <module name="MissingSwitchDefault"/>
   169 	<module name="MissingSwitchDefault"/>
   168         <module name="RedundantThrows"/>
   170 	<module name="RedundantThrows"/>
   169         <module name="SimplifyBooleanExpression"/>
   171 	<module name="SimplifyBooleanExpression"/>
   170         <module name="SimplifyBooleanReturn"/>
   172 	<module name="SimplifyBooleanReturn"/>
   171 	<module name="StringLiteralEquality"/>
   173 	<module name="StringLiteralEquality"/>
   172 	<module name="SuperFinalize"/>
   174 	<module name="SuperFinalize"/>
   173 	<module name="IllegalCatch"/>
   175 	<module name="IllegalCatch"/>
   174 	<module name="IllegalThrows"/>
   176 	<module name="IllegalThrows"/>
   175 	<module name="PackageDeclaration"/>
   177 	<module name="PackageDeclaration"/>
   183 	<module name="MultipleVariableDeclarations"/>
   185 	<module name="MultipleVariableDeclarations"/>
   184 	<module name="UnnecessaryParentheses"/>
   186 	<module name="UnnecessaryParentheses"/>
   185 	<module name="ParameterAssignment"/>
   187 	<module name="ParameterAssignment"/>
   186 	<module name="SuperClone"/>
   188 	<module name="SuperClone"/>
   187 
   189 
   188         <!-- Checks for class design                         -->
   190 	<!-- Checks for class design                         -->
   189         <!-- See http://checkstyle.sf.net/config_design.html -->
   191 	<!-- See http://checkstyle.sf.net/config_design.html -->
   190         <module name="DesignForExtension"/>
   192 	<module name="DesignForExtension"/>
   191         <module name="FinalClass"/>
   193 	<module name="FinalClass"/>
   192         <module name="HideUtilityClassConstructor"/>
   194 	<module name="HideUtilityClassConstructor"/>
   193         <module name="InterfaceIsType"/>
   195 	<module name="InterfaceIsType"/>
   194         <module name="VisibilityModifier"/>
   196 	<module name="VisibilityModifier"/>
   195 	<module name="MutableException"/>
   197 	<module name="MutableException"/>
   196 	    
   198 
   197 
   199 
   198         <!-- Miscellaneous other checks.                   -->
   200 	<!-- Miscellaneous other checks.                   -->
   199         <!-- See http://checkstyle.sf.net/config_misc.html -->
   201 	<!-- See http://checkstyle.sf.net/config_misc.html -->
   200         <module name="ArrayTypeStyle"/>
   202 	<module name="ArrayTypeStyle"/>
   201 	<module name="FinalParameters">
   203 	<module name="FinalParameters">
   202 	    <property name="tokens" value="CTOR_DEF"/>
   204 	    <property name="tokens" value="CTOR_DEF"/>
   203 	</module>
   205 	</module>
   204 	<module name="Indentation"/>
   206 	<module name="Indentation"/>
   205 	
   207 
   206         <module name="GenericIllegalRegexp">
   208 	<module name="GenericIllegalRegexp">
   207             <property name="format" value="\s+$"/>
   209 	    <property name="format" value="\s+$"/>
   208             <property name="message" value="Line has trailing spaces."/>
   210 	    <property name="message" value="Line has trailing spaces."/>
   209         </module>
   211 	</module>
   210         <module name="TodoComment"/>
   212 	<module name="TodoComment"/>
   211         <module name="UpperEll"/>
   213 	<module name="UpperEll"/>
   212 
   214 
   213 	<module name="StrictDuplicateCode"/>
       
   214 	<module name="BooleanExpressionComplexity"/>
   215 	<module name="BooleanExpressionComplexity"/>
   215 	<module name="NewlineAtEndOfFile"/>
       
   216 	<module name="UpperEll"/>
   216 	<module name="UpperEll"/>
   217 
   217 
   218 
   218 
   219 	<module name="ArrayTypeStyle"/>
   219 	<module name="ArrayTypeStyle"/>
   220 
   220 
   221 	    
       
   222 	    
       
   223 	    
       
   224 
       
   225     </module>
   221     </module>
       
   222     <module name="StrictDuplicateCode"/>
       
   223     <module name="NewlineAtEndOfFile"/>
   226 
   224 
   227 </module>
   225 </module>