config/sun_checks.xml Predefined Ruleset

Maven Checkstyle plugin contains config/sun_checks.xml predefined ruleset derived from the configuration included in Checkstyle sources:

<?xml version="1.0"?>
    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"


  Checkstyle configuration that checks the sun coding conventions from:

    - the Java Language Specification at

    - the Sun Code Conventions at

    - the Javadoc guidelines at

    - the JDK Api documentation

    - some best practices

  Checkstyle is very configurable. Be sure to read the documentation at (or in your downloaded distribution).

  Most Checks are configurable, be sure to consult the documentation.

  To completely disable a check, just comment it out or delete it from the file.

  Finally, it is worth reading the documentation.


<module name="Checker">
        If you set the basedir property below, then all reported file
        names will be relative to the specified directory. See

        <property name="basedir" value="${basedir}"/>

    <!-- Checks that each Java package has a Javadoc file used for commenting. -->
    <!-- See       -->
    <module name="JavadocPackage">
      <property name="allowLegacy" value="true"/>

    <!-- Checks whether files end with a new line.                        -->
    <!-- See -->
    <module name="NewlineAtEndOfFile"/>

    <!-- Checks that property files contain the same keys.         -->
    <!-- See -->
    <module name="Translation"/>

    <module name="FileLength"/>

    <!-- Following interprets the header file as regular expressions. -->
    <!-- <module name="RegexpHeader"/>                                -->

    <module name="FileTabCharacter">
        <property name="eachLine" value="true"/>

    <module name="RegexpSingleline">
        <!-- \s matches whitespace character, $ matches end of line. -->
        <property name="format" value="\s+$"/>
        <property name="message" value="Line has trailing spaces."/>

    <module name="TreeWalker">

        <property name="cacheFile" value="${checkstyle.cache.file}"/>

        <!-- required for SuppressWarningsFilter (and other Suppress* rules not used here) -->
        <!-- see -->
        <module name="SuppressWarningsHolder"/>

        <!-- Checks for Javadoc comments.                     -->
        <!-- See -->
        <module name="JavadocMethod"/>
        <module name="JavadocType"/>
        <module name="JavadocVariable"/>
        <module name="JavadocStyle"/>

        <!-- Checks for Naming Conventions.                  -->
        <!-- See -->
        <module name="ConstantName"/>
        <module name="LocalFinalVariableName"/>
        <module name="LocalVariableName"/>
        <module name="MemberName"/>
        <module name="MethodName"/>
        <module name="PackageName"/>
        <module name="ParameterName"/>
        <module name="StaticVariableName"/>
        <module name="TypeName"/>

        <!-- Checks for Headers                                -->
        <!-- See   -->
        <!-- <module name="Header">                            -->
            <!-- The follow property value demonstrates the ability     -->
            <!-- to have access to ANT properties. In this case it uses -->
            <!-- the ${basedir} property to allow Checkstyle to be run  -->
            <!-- from any directory within a project. See property      -->
            <!-- expansion,                                             -->
            <!--        -->
            <!-- <property                                              -->
            <!--     name="headerFile"                                  -->
            <!--     value="${basedir}/java.header"/>                   -->
        <!-- </module> -->

        <!-- Checks for imports                              -->
        <!-- See -->
        <module name="AvoidStarImport"/>
        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
        <module name="RedundantImport"/>
        <module name="UnusedImports"/>

        <!-- Checks for Size Violations.                    -->
        <!-- See -->
        <module name="LineLength"/>
        <module name="MethodLength"/>
        <module name="ParameterNumber"/>

        <!-- Checks for whitespace                               -->
        <!-- See -->
        <module name="EmptyForIteratorPad"/>
        <module name="MethodParamPad"/>
        <module name="NoWhitespaceAfter"/>
        <module name="NoWhitespaceBefore"/>
        <module name="OperatorWrap"/>
        <module name="ParenPad"/>
        <module name="TypecastParenPad"/>
        <module name="WhitespaceAfter"/>
        <module name="WhitespaceAround"/>

        <!-- Modifier Checks                                    -->
        <!-- See -->
        <module name="ModifierOrder"/>
        <module name="RedundantModifier"/>

        <!-- Checks for blocks. You know, those {}'s         -->
        <!-- See -->
        <module name="AvoidNestedBlocks"/>
        <module name="EmptyBlock"/>
        <module name="LeftCurly"/>
        <module name="NeedBraces"/>
        <module name="RightCurly"/>

        <!-- Checks for common coding problems               -->
        <!-- See -->
        <module name="AvoidInlineConditionals"/>
        <module name="EmptyStatement"/>
        <module name="EqualsHashCode"/>
        <module name="HiddenField"/>
        <module name="IllegalInstantiation"/>
        <module name="InnerAssignment"/>
        <module name="MagicNumber"/>
        <module name="MissingSwitchDefault"/>
        <module name="SimplifyBooleanExpression"/>
        <module name="SimplifyBooleanReturn"/>

        <!-- Checks for class design                         -->
        <!-- See -->
        <module name="DesignForExtension"/>
        <module name="FinalClass"/>
        <module name="HideUtilityClassConstructor"/>
        <module name="InterfaceIsType"/>
        <module name="VisibilityModifier"/>

        <!-- Miscellaneous other checks.                   -->
        <!-- See -->
        <module name="ArrayTypeStyle"/>
        <module name="FinalParameters"/>
        <module name="TodoComment"/>
        <module name="UpperEll"/>


    <!-- Support @SuppressWarnings (added in Checkstyle 5.7) -->
    <!-- see -->
    <module name="SuppressWarningsFilter"/>

    <!-- Checks properties file for a duplicated properties. -->
    <!-- See -->
    <module name="UniqueProperties"/>