<?xml version="1.0"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
<module name = "Checker">
    <property name="charset" value="UTF-8"/>
    <property name="severity" value="warning"/>
    <property name="fileExtensions" value="java, properties, xml"/>
    <module name="Header">
        <property name="headerFile" value="copyright.txt"/>
        <property name="fileExtensions" value="java"/>
    </module>
    <module name="FileTabCharacter">
        <property name="eachLine" value="true"/>
    </module>
    <module name="FileLength"/>
    <module name="NewlineAtEndOfFile">
        <property name="lineSeparator" value="lf"/>
    </module>
    <module name="Translation"/>
    <module name="UniqueProperties"/>
    <module name="SeverityMatchFilter"/>
    
    <module name="TreeWalker">
        
        <!-- Naming Conventions -->
        <module name="PackageName">
            <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
        </module>
        <module name="TypeName"/>
        <module name="MethodName"/>
        <module name="InterfaceTypeParameterName"/>
        <module name="ClassTypeParameterName"/>
        <module name="MethodTypeParameterName"/>
        <module name="ConstantName"/>
        <module name="StaticVariableName"/>
        <module name="MemberName"/>
        <module name="LocalVariableName"/>
        <module name="LocalFinalVariableName"/>
        <module name="ParameterName"/>
        <module name="CatchParameterName"/>
        <module name="AbbreviationAsWordInName">
            <property name="allowedAbbreviationLength" value="6"/>
        </module>
        
        <!-- Size Violations -->
        <module name="AnonInnerLength"/>
        <module name="MethodLength"/>
        <module name="LineLength">
            <property name="max" value="200"/>
        </module>
        <module name="MethodCount"/>
        <module name="ExecutableStatementCount">
            <property name="max" value="50"/>
        </module>
        <module name="OuterTypeNumber"/>
        <module name="ParameterNumber"/>

        <!-- Whitespace -->
        <module name="EmptyForInitializerPad"/>
        <module name="EmptyForIteratorPad"/>
        <module name="MethodParamPad"/>
        <module name="ParenPad"/>
        <module name="TypecastParenPad"/>
        <module name="NoLineWrap"/>
        <module name="OperatorWrap"/>
        <module name="SeparatorWrap">
            <property name="id" value="SeparatorWrapDot"/>
            <property name="tokens" value="DOT"/>
            <property name="option" value="nl"/>
        </module>
        <module name="SeparatorWrap">
            <property name="id" value="SeparatorWrapComma"/>
            <property name="tokens" value="COMMA"/>
            <property name="option" value="EOL"/>
        </module>
        <module name="SeparatorWrap">
            <property name="id" value="SeparatorWrapEllipsis"/>
            <property name="tokens" value="ELLIPSIS"/>
            <property name="option" value="EOL"/>
        </module>
        <module name="SeparatorWrap">
            <property name="id" value="SeparatorWrapArrayDeclarator"/>
            <property name="tokens" value="ARRAY_DECLARATOR"/>
            <property name="option" value="EOL"/>
        </module>
        <module name="SeparatorWrap">
            <property name="id" value="SeparatorWrapMethodRef"/>
            <property name="tokens" value="METHOD_REF"/>
            <property name="option" value="nl"/>
        </module>
        <module name="GenericWhitespace"/>
        <module name="NoWhitespaceBefore"/>
        <module name="NoWhitespaceAfter"/>
        <module name="WhitespaceAround"/>
        <module name="WhitespaceAfter"/>
        <module name="SingleSpaceSeparator"/>
        <module name="EmptyLineSeparator">
            <property name="allowMultipleEmptyLines" value="false"/>
            <property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
        </module>
        
        <!-- Imports -->
        <module name="AvoidStarImport"/>
        <module name="AvoidStaticImport">
            <property name="excludes" value="org.junit.Assert.*,org.hamcrest.CoreMatchers.*,org.mockito.Mockito.*,org.mockito.ArgumentMatchers.*"/>
        </module>
        <module name="IllegalImport"/>
        <module name="RedundantImport"/>
        <module name="UnusedImports"/>
        <module name="CustomImportOrder"/>
        
        <!-- Annotations -->
        <module name="AnnotationLocation">
            <property name="id" value="AnnotationLocationMostCases"/>
            <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
        </module>
        <module name="AnnotationLocation">
            <property name="id" value="AnnotationLocationVariables"/>
            <property name="tokens" value="VARIABLE_DEF"/>
            <property name="allowSamelineMultipleAnnotations" value="true"/>
        </module>
        <module name="AnnotationUseStyle"/>
        <module name="MissingOverride"/>
        <module name="SuppressWarnings"/>
        <module name="MissingDeprecated"/>
        <module name="SuppressWarningsHolder"/>

        <!-- Modifiers -->
        <module name="ModifierOrder"/>
        <module name="RedundantModifier"/>
        
        <!-- Coding -->
        <module name="ArrayTrailingComma"/>
        <module name="CovariantEquals"/>
        <module name="DefaultComesLast"/>
        <module name="DeclarationOrder"/>
        <module name="EmptyStatement"/>
        <module name="EqualsAvoidNull"/>
        <module name="EqualsHashCode"/>
        <module name="ExplicitInitialization"/>
        <module name="FallThrough"/>
        <module name="IllegalInstantiation"/>
        <module name="IllegalCatch"/>
        <module name="IllegalThrows"/>
        <module name="IllegalType">
            <property name="tokens" value="METHOD_DEF,PARAMETER_DEF,VARIABLE_DEF"/>
        </module>
        <module name="IllegalTokenText">
            <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
            <property name="format" value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
            <property name="message" value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
        </module>
        <module name="MissingSwitchDefault"/>
        <module name="ModifiedControlVariable"/>
        <module name="MultipleVariableDeclarations"/>
        <module name="NestedForDepth"/>
        <module name="NestedIfDepth"/>
        <module name="NestedTryDepth"/>
        <module name="NoClone"/>
        <module name="NoFinalizer"/>
        <module name="SuperClone"/>
        <module name="SuperFinalize"/>
        <module name="OneStatementPerLine"/>
        <module name="OverloadMethodsDeclarationOrder"/>
        <module name="PackageDeclaration"/>
        <module name="ParameterAssignment"/>
        <module name="SimplifyBooleanExpression"/>
        <module name="SimplifyBooleanReturn"/>
        <module name="StringLiteralEquality"/>
        <module name="UnnecessaryParentheses"/>
        <module name="VariableDeclarationUsageDistance"/>
        
        <!-- Block Checks -->
        <module name="EmptyBlock"/>
        <module name="EmptyCatchBlock">
            <property name="exceptionVariableName" value="expected|ignore"/>
        </module>
        <module name="AvoidNestedBlocks"/>
        <module name="NeedBraces"/>
        <module name="LeftCurly"/>
        <module name="RightCurly"/>
        
        <!-- Class Design -->
        <module name="DesignForExtension"/>
        <module name="FinalClass"/>
        <!-- cannot recognize for lombok @NoArgsConstructor(access = AccessLevel.PRIVATE), just ignore -->
        <!--<module name="HideUtilityClassConstructor"/>-->
        <module name="OneTopLevelClass"/>
        <module name="InterfaceIsType"/>
        <module name="InnerTypeLast"/>
        <module name="VisibilityModifier"/>
        <module name="MutableException"/>
        <module name="ThrowsCount"/>
        
        <!-- Metrics -->
        <module name="BooleanExpressionComplexity"/>
        <module name="ClassDataAbstractionCoupling">
            <property name="max" value="10"/>
        </module>
        <module name="ClassFanOutComplexity"/>
        <module name="CyclomaticComplexity"/>
        <module name="NPathComplexity"/>
        <module name="JavaNCSS"/>
        
        <!-- Miscellaneous -->
        <module name="ArrayTypeStyle"/>
        <module name="UpperEll"/>
        <module name="AvoidEscapedUnicodeCharacters"/>
        <module name="DescendantToken"/>
        <module name="FinalParameters"/>
        <module name="Indentation"/>
        <module name="OuterTypeFilename"/>
        <module name="TodoComment"/>
        <module name="TrailingComment"/>
        <module name="UncommentedMain">
            <property name="excludedClasses" value="\.Bootstrap"/>
        </module>
        
        <!-- Javadoc Comments -->
        <module name="AtclauseOrder">
            <property name="tagOrder" value="@author, @param, @return, @throws, @deprecated"/>
        </module>
        <module name="NonEmptyAtclauseDescription"/>
        <module name="JavadocParagraph"/>
        <module name="JavadocStyle"/>
        <module name="JavadocTagContinuationIndentation"/>
        <module name="SingleLineJavadoc"/>
        <module name="SummaryJavadoc"/>
        <!--
        <module name="JavadocType">
            <property name="scope" value="public"/>
        </module>
        -->
        <module name="JavadocMethod">
            <property name="scope" value="public"/>
            <property name="allowedAnnotations" value="Override, Test, Before, After, BeforeClass, AfterClass, Parameterized, Parameters"/>
            <property name="ignoreMethodNamesRegex" value="^assert.*$|^verify.*$"/>
            <property name="tokens" value="METHOD_DEF, ANNOTATION_FIELD_DEF"/>
        </module>
        
        <!-- Filters -->
        <module name="SuppressionCommentFilter"/>
        <module name="SuppressWithNearbyCommentFilter"/>
    </module>
</module>
