<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
        "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
        "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<module name="Checker">
    <property name="severity" value="error"/>

    <module name="Translation"/>

    <module name="JavadocPackage">
        <property name="allowLegacy" value="true"/>
    </module>

    <!-- Header -->
    <module name="Header">
        <property name="headerFile" value="${checkstyle.header.file}"/>
    </module>

    <module name="FileLength">
        <property name="max" value="1400"/>
    </module>

    <!-- Duplicate Code -->
    <module name="StrictDuplicateCode">
        <property name="min" value="30"/>
    </module>
    
    <module name="FileTabCharacter"/>

    <!-- Miscellaneous -->
    <module name="RegexpSingleline">
        <property name="format" value="System\.(out|err)\.print"/>
    </module>
    <!-- Make sure commons logging is not used -->
    <module name="RegexpSingleline">
        <property name="format" value="import org\.apache\.commons\.logging\.Log;"/>
    </module>
    <!-- Make sure we are using safe element.get methods everywhere -->
    <!-- module name="RegexpSingleline">
        <property name="severity" value="warning"/>
        <property name="format" value="(?&lt;!entry)\.getKey\(\)"/>
    </module>
    <module name="RegexpSingleline">
        <property name="severity" value="warning"/>
        <property name="format" value="(?&lt;!entry)\.getValue\(\)"/>
    </module -->

    <module name="TreeWalker">
        <property name="cacheFile" value="target/checkstyle.cache"/>
        
        <!-- javadoc -->
        <module name="JavadocType">
            <property name="scope" value="private"/>
            <property name="authorFormat" value=".+"/>
        </module>
        <module name="JavadocMethod">
            <property name="scope" value="package"/>
            <property name="allowMissingParamTags" value="true"/>
            <property name="allowMissingThrowsTags" value="true"/>
            <property name="allowMissingReturnTag" value="true"/>
        </module>
        <module name="JavadocVariable">
            <property name="scope" value="package"/>
        </module>
        <module name="JavadocStyle">
            <property name="scope" value="public"/>
            <property name="checkFirstSentence" value="false"/>
        </module>

        <!-- Naming Conventions -->
        <module name="ConstantName"/>
        <module name="MethodName"/>
        <module name="StaticVariableName"/>
        <module name="LocalFinalVariableName"/>
        <module name="LocalVariableName"/>
        <module name="MemberName"/>
        <module name="PackageName">
            <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
        </module>
        <module name="ParameterName"/>
        <module name="TypeName"/>


        <!-- Imports -->
        <module name="AvoidStarImport"/>
        <module name="IllegalImport"/>
        <module name="UnusedImports"/>

        <!-- Size Violations -->
        <module name="LineLength">
            <property name="max" value="150"/>
            <property name="ignorePattern" value="^ *\* *"/>
        </module>
        <module name="MethodLength">
            <property name="max" value="200"/>
            <property name="tokens" value="METHOD_DEF"/>
        </module>
        <module name="MethodLength">
            <property name="max" value="60"/>
            <property name="tokens" value="CTOR_DEF"/>
        </module>
        <module name="ParameterNumber">
            <property name="max" value="8"/>
            <property name="tokens" value="METHOD_DEF"/>
        </module>
        <module name="ParameterNumber">
            <property name="max" value="12"/>
            <property name="tokens" value="CTOR_DEF"/>
        </module>
        <module name="AnonInnerLength">
            <property name="max" value="25"/>
        </module>
        <module name="ExecutableStatementCount">
            <property name="max" value="20"/>
            <property name="tokens" value="CTOR_DEF, INSTANCE_INIT, STATIC_INIT"/>
        </module>

        <!-- Whitespace -->
        <module name="EmptyForInitializerPad"/>
        <module name="EmptyForIteratorPad"/>
        <module name="MethodParamPad"/>
        <module name="NoWhitespaceAfter">
            <property name="allowLineBreaks" value="false"/>
        </module>
        <module name="NoWhitespaceBefore">
            <property name="allowLineBreaks" value="false"/>
        </module>
        <module name="ParenPad"/>
        <module name="WhitespaceAfter">
            <property name="tokens" value="COMMA, SEMI"/>
        </module>
        <module name="WhitespaceAround">
            <property name="tokens"
                      value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
        </module>
        <module name="OperatorWrap">
            <property name="tokens"
                      value="ASSIGN, DIV_ASSIGN, PLUS_ASSIGN, MINUS_ASSIGN, STAR_ASSIGN, MOD_ASSIGN, SR_ASSIGN, BSR_ASSIGN, SL_ASSIGN, BXOR_ASSIGN, BOR_ASSIGN, BAND_ASSIGN"/>
            <property name="option" value="eol"/>
        </module>

        <!-- Modifiers -->
        <module name="ModifierOrder"/>

        <!-- Blocks -->
        <module name="EmptyBlock">
            <property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/>
        </module>
        <module name="RightCurly">
            <property name="option" value="same"/>
        </module>
        <module name="LeftCurly"/>
        <module name="NeedBraces"/>
        <module name="AvoidNestedBlocks">
            <property name="allowInSwitchCase" value="true"/>
        </module>

        <!-- Coding Problems -->
        <module name="CovariantEquals"/>
        <module name="DeclarationOrder"/>
        <module name="DefaultComesLast"/>
        <module name="FallThrough"/>
        <module name="DoubleCheckedLocking"/>
        <module name="EmptyStatement"/>
        <module name="HiddenField">
            <property name="tokens" value="VARIABLE_DEF"/>
        </module>
        <module name="IllegalInstantiation">
            <property name="classes" value="java.lang.Boolean"/>
            <property name="classes" value="java.lang.Byte"/>
            <property name="classes" value="java.lang.Short"/>
            <property name="classes" value="java.lang.Integer"/>
            <property name="classes" value="java.lang.Long"/>
            <property name="classes" value="java.lang.Character"/>
        </module>
        <module name="IllegalTokenText">
            <property name="tokens" value="NUM_INT,NUM_LONG"/>
            <property name="format" value="^0[^lx]"/>
            <property name="ignoreCase" value="true"/>
        </module>
        <module name="IllegalType">
            <property name="ignoredMethodNames" value="getInstance"/>
            <property name="tokens" value="PARAMETER_DEF, METHOD_DEF"/>
        </module>
        <module name="InnerAssignment"/>
        <module name="ReturnCount">
            <property name="max" value="5"/>
        </module>
        <module name="NestedIfDepth">
            <property name="max" value="2"/>
        </module>
        <module name="NestedTryDepth">
            <property name="max" value="2"/>
        </module>
        <module name="PackageDeclaration"/>
        <module name="SimplifyBooleanExpression"/>
        <module name="SimplifyBooleanReturn"/>
        <module name="StringLiteralEquality"/>
        <module name="SuperClone"/>
        <module name="SuperFinalize"/>
        <module name="MagicNumber">
            <property name="ignoreHashCodeMethod" value="true"/>
        </module>
        <module name="EqualsHashCode"/>
        <module name="MissingSwitchDefault"/>

        <!-- Class Design -->
        <module name="FinalClass"/>
        <!-- module name="HideUtilityClassConstructor"/-->
        <module name="InterfaceIsType"/>
        <module name="MutableException"/>
        <module name="ThrowsCount">
            <property name="max" value="3"/>
        </module>
        <module name="VisibilityModifier">
            <property name="protectedAllowed" value="true"/>
        </module>

        <!-- Metrics -->
        <module name="BooleanExpressionComplexity">
            <property name="max" value="4"/>
        </module>
        <module name="ClassDataAbstractionCoupling">
            <property name="max" value="15"/>
        </module>
        <module name="ClassFanOutComplexity">
            <property name="max" value="40"/>
        </module>
        <module name="CyclomaticComplexity">
            <property name="max" value="12"/>
        </module>
        <module name="NPathComplexity"/>

        <module name="ArrayTypeStyle"/>
        <module name="TodoComment"/>
        <module name="TrailingComment"/>
        <module name="UpperEll"/>
    </module>
</module>
