checkstyle.xml
changeset 32 4d26854143e2
child 33 0e65d5f55d2f
equal deleted inserted replaced
31:85faac00d92c 32:4d26854143e2
       
     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 	    <property name="allowUndeclaredRTE" value="true"/>
       
    54 	</module>
       
    55         <module name="JavadocType"/>
       
    56         <module name="JavadocVariable"/>
       
    57         <module name="JavadocStyle"/>
       
    58 	    <property name="checkEmptyJavadoc" value="true"/>
       
    59 	</module>
       
    60 
       
    61 
       
    62         <!-- Checks for Naming Conventions.                  -->
       
    63         <!-- See http://checkstyle.sf.net/config_naming.html -->
       
    64         <module name="ConstantName"/>
       
    65         <module name="LocalFinalVariableName"/>
       
    66         <module name="LocalVariableName"/>
       
    67 	<module name="MemberName">
       
    68 	    <property  name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
       
    69 	</module>
       
    70         <module name="MethodName"/>
       
    71         <module name="PackageName"/>
       
    72         <module name="ParameterName"/>
       
    73         <module name="StaticVariableName"/>
       
    74         <module name="TypeName"/>
       
    75 
       
    76 
       
    77         <!-- Checks for Headers                                -->
       
    78         <!-- See http://checkstyle.sf.net/config_header.html   -->
       
    79         <!-- <module name="Header">                            -->
       
    80             <!-- The follow property value demonstrates the ability     -->
       
    81             <!-- to have access to ANT properties. In this case it uses -->
       
    82             <!-- the ${basedir} property to allow Checkstyle to be run  -->
       
    83             <!-- from any directory within a project. See property      -->
       
    84             <!-- expansion,                                             -->
       
    85             <!-- http://checkstyle.sf.net/config.html#properties        -->
       
    86             <!-- <property                                              -->
       
    87             <!--     name="headerFile"                                  -->
       
    88             <!--     value="${basedir}/java.header"/>                   -->
       
    89         <!-- </module> -->
       
    90 
       
    91         <!-- Following interprets the header file as regular expressions. -->
       
    92         <!-- <module name="RegexpHeader"/>                                -->
       
    93 
       
    94 
       
    95         <!-- Checks for imports                              -->
       
    96         <!-- See http://checkstyle.sf.net/config_import.html -->
       
    97         <module name="AvoidStarImport"/>
       
    98         <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
       
    99         <module name="RedundantImport"/>
       
   100         <module name="UnusedImports"/>
       
   101 
       
   102 
       
   103         <!-- Checks for Size Violations.                    -->
       
   104         <!-- See http://checkstyle.sf.net/config_sizes.html -->
       
   105         <module name="FileLength"/>
       
   106 	<module name="LineLength">
       
   107 	    <property name="max" value="120" />
       
   108 	</module>
       
   109         <module name="MethodLength"/>
       
   110         <module name="ParameterNumber"/>
       
   111 	<module name="AnonInnerLength">
       
   112 	    <property name="max" value="60" />
       
   113 	</module>
       
   114 
       
   115 
       
   116         <!-- Checks for whitespace                               -->
       
   117         <!-- See http://checkstyle.sf.net/config_whitespace.html -->
       
   118         <module name="EmptyForIteratorPad"/>
       
   119         <module name="MethodParamPad"/>
       
   120         <module name="NoWhitespaceAfter"/>
       
   121         <module name="NoWhitespaceBefore"/>
       
   122         <module name="OperatorWrap"/>
       
   123         <module name="ParenPad"/>
       
   124         <module name="TypecastParenPad"/>
       
   125 	<!-- We want mixed tabulation
       
   126 	  <module name="TabCharacter"/> 
       
   127       -->
       
   128         <module name="WhitespaceAfter"/>
       
   129         <module name="WhitespaceAround"/>
       
   130 
       
   131 
       
   132         <!-- Modifier Checks                                    -->
       
   133         <!-- See http://checkstyle.sf.net/config_modifiers.html -->
       
   134         <module name="ModifierOrder"/>
       
   135         <module name="RedundantModifier"/>
       
   136 
       
   137 
       
   138         <!-- Checks for blocks. You know, those {}'s         -->
       
   139         <!-- See http://checkstyle.sf.net/config_blocks.html -->
       
   140         <module name="AvoidNestedBlocks"/>
       
   141         <module name="EmptyBlock"/>
       
   142         <module name="LeftCurly"/>
       
   143 	<!--
       
   144 	  <module name="NeedBraces"/>
       
   145 	  -->
       
   146         <module name="RightCurly"/>
       
   147 
       
   148 
       
   149         <!-- Checks for common coding problems               -->
       
   150         <!-- See http://checkstyle.sf.net/config_coding.html -->
       
   151 	<module name="CovariantEquals"/>
       
   152         <module name="AvoidInlineConditionals"/>
       
   153 	<module name="InnerAssignment" />
       
   154         <module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
       
   155         <module name="EmptyStatement"/>
       
   156         <module name="EqualsHashCode"/>
       
   157 	<module name="HiddenField">
       
   158 	    <property name="ignoreConstructorParameter" value="true"/>
       
   159 	    <property name="ignoreAbstractMethods" value="true"/>
       
   160 	    <property name="ignoreSetter" value="true"/>
       
   161 	</module>
       
   162         <module name="IllegalInstantiation"/>
       
   163         <module name="InnerAssignment"/>
       
   164 	<!--
       
   165 	  <module name="MagicNumber"/>
       
   166 	  -->
       
   167         <module name="MissingSwitchDefault"/>
       
   168         <module name="RedundantThrows"/>
       
   169         <module name="SimplifyBooleanExpression"/>
       
   170         <module name="SimplifyBooleanReturn"/>
       
   171 	<module name="StringLiteralEquality"/>
       
   172 	<module name="SuperFinalize"/>
       
   173 	<module name="IllegalCatch"/>
       
   174 	<module name="IllegalThrows"/>
       
   175 	<module name="PackageDeclaration"/>
       
   176 	<module name="JUnitTestCase"/>
       
   177 	<module name="DeclarationOrder"/>
       
   178 	<module name="ExplicitInitialization"/>
       
   179 	<module name="DefaultComesLast"/>
       
   180 	<module name="MissingCtor"/>
       
   181 	<module name="FallThrough"/>
       
   182 	<module name="MultipleStringLiterals"/>
       
   183 	<module name="MultipleVariableDeclarations"/>
       
   184 	<module name="UnnecessaryParentheses"/>
       
   185 	<module name="ParameterAssignment"/>
       
   186 	<module name="SuperClone"/>
       
   187 
       
   188         <!-- Checks for class design                         -->
       
   189         <!-- See http://checkstyle.sf.net/config_design.html -->
       
   190         <module name="DesignForExtension"/>
       
   191         <module name="FinalClass"/>
       
   192         <module name="HideUtilityClassConstructor"/>
       
   193         <module name="InterfaceIsType"/>
       
   194         <module name="VisibilityModifier"/>
       
   195 	<module name="MutableException"/>
       
   196 	    
       
   197 
       
   198         <!-- Miscellaneous other checks.                   -->
       
   199         <!-- See http://checkstyle.sf.net/config_misc.html -->
       
   200         <module name="ArrayTypeStyle"/>
       
   201 	<module name="FinalParameters">
       
   202 	    <property name="tokens" value="CTOR_DEF"/>
       
   203 	</module>
       
   204 	<module name="Indentation"/>
       
   205 	
       
   206         <module name="GenericIllegalRegexp">
       
   207             <property name="format" value="\s+$"/>
       
   208             <property name="message" value="Line has trailing spaces."/>
       
   209         </module>
       
   210         <module name="TodoComment"/>
       
   211         <module name="UpperEll"/>
       
   212 
       
   213 	<module name="StrictDuplicateCode"/>
       
   214 	<module name="BooleanExpressionComplexity"/>
       
   215 	<module name="NewlineAtEndOfFile"/>
       
   216 	<module name="UpperEll"/>
       
   217 
       
   218 
       
   219 	<module name="ArrayTypeStyle"/>
       
   220 
       
   221 	    
       
   222 	    
       
   223 	    
       
   224 
       
   225     </module>
       
   226 
       
   227 </module>