<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
        "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
        "https://checkstyle.org/dtds/configuration_1_3.dtd">

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

    <property name="fileExtensions" value="java, properties, xml"/>

    <!-- Excludes all 'module-info.java' files              -->
    <!-- See https://checkstyle.org/config_filefilters.html -->
    <module name="BeforeExecutionExclusionFileFilter">
        <property name="fileNamePattern" value="module\-info\.java$"/>
    </module>

    <!-- Only public (API, SPI) classes must have Javadoc -->
<!--    <module name="SuppressionSingleFilter">-->
<!--        <property name="checks" value=".*Javadoc.*"/>-->
<!--        <property name="files" value="src/main/java/org/hyperledger/fabric/client/impl"/>-->
<!--    </module>-->

    <!-- Checks that a package-info.java file exists for each package.     -->
    <!-- See https://checkstyle.org/config_javadoc.html#JavadocPackage -->
<!--    <module name="JavadocPackage"/>-->

    <!-- Checks whether files end with a new line.                        -->
    <!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile -->
    <module name="NewlineAtEndOfFile"/>

    <!-- Checks that property files contain the same keys.         -->
    <!-- See https://checkstyle.org/config_misc.html#Translation -->
    <module name="Translation"/>

    <!-- Checks for Size Violations.                    -->
    <!-- See https://checkstyle.org/config_sizes.html -->
    <module name="FileLength"/>
    <module name="LineLength">
        <property name="fileExtensions" value="java"/>
        <property name="ignorePattern" value="^ +\* +"/>
        <property name="max" value="160"/>
    </module>

    <!-- Checks for whitespace                               -->
    <!-- See https://checkstyle.org/config_whitespace.html -->
    <module name="FileTabCharacter"/>

    <!-- Miscellaneous other checks.                   -->
    <!-- See https://checkstyle.org/config_misc.html -->
    <module name="RegexpSingleline">
        <property name="format" value="\s+$"/>
        <property name="minimum" value="0"/>
        <property name="maximum" value="0"/>
        <property name="message" value="Line has trailing spaces."/>
    </module>

    <!-- Checks for Headers                                -->
    <!-- See https://checkstyle.org/config_header.html   -->
    <module name="RegexpHeader">
        <property name="headerFile" value="${config_loc}/java-copyright-header.txt"/>
        <property name="fileExtensions" value="java"/>
    </module>

    <module name="TreeWalker">

        <!-- Checkstyle ignore current line with a comment: // checkstyle:ignore-line:RuleName1|RuleName2 -->
        <module name="SuppressWithNearbyCommentFilter">
            <property name="commentFormat" value="checkstyle:ignore-line:(\w+(\|\w+)*)"/>
            <property name="checkFormat" value="$1"/>
        </module>

        <!-- Checkstyle ignore next line with a comment: // checkstyle:ignore-next-line:RuleName1|RuleName2 -->
        <module name="SuppressWithNearbyCommentFilter">
            <property name="commentFormat" value="checkstyle:ignore-next-line:(\w+(\|\w+)*)"/>
            <property name="checkFormat" value="$1"/>
            <property name="influenceFormat" value="1"/>
        </module>

        <!-- Checks for Javadoc comments.                     -->
        <!-- See https://checkstyle.org/config_javadoc.html -->
        <module name="InvalidJavadocPosition"/>
        <module name="JavadocContentLocation"/>
        <module name="JavadocMethod"/>
        <module name="JavadocMissingLeadingAsterisk"/>
        <module name="JavadocMissingWhitespaceAfterAsterisk"/>
        <module name="JavadocParagraph"/>
        <module name="JavadocStyle"/>
        <module name="JavadocType"/>
<!--        <module name="JavadocVariable">-->
<!--            <property name="scope" value="protected"/>-->
<!--        </module>-->
        <module name="JavadocStyle"/>
<!--        <module name="MissingJavadocMethod"/>-->
<!--        <module name="MissingJavadocType"/>-->
        <module name="NonEmptyAtclauseDescription"/>

        <!-- Checks for Naming Conventions.                  -->
        <!-- See https://checkstyle.org/config_naming.html -->
        <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 imports                              -->
        <!-- See https://checkstyle.org/config_import.html -->
        <module name="AvoidStarImport"/>
        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
        <module name="RedundantImport"/>
        <module name="UnusedImports">
            <property name="processJavadoc" value="false"/>
        </module>

        <!-- Checks for Size Violations.                    -->
        <!-- See https://checkstyle.org/config_sizes.html -->
        <module name="MethodLength"/>
        <module name="ParameterNumber"/>

        <!-- Checks for whitespace                               -->
        <!-- See https://checkstyle.org/config_whitespace.html -->
<!--        <module name="EmptyLineSeparator">-->
<!--            <property name="allowNoEmptyLineBetweenFields" value="true"/>-->
<!--            <property name="allowMultipleEmptyLines" value="false"/>-->
<!--            <property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>-->
<!--        </module>-->
        <module name="GenericWhitespace"/>
        <module name="MethodParamPad"/>
        <module name="NoWhitespaceAfter"/>
        <module name="NoWhitespaceBefore"/>
        <module name="OperatorWrap"/>
        <module name="ParenPad"/>
        <module name="SingleSpaceSeparator"/>
        <module name="TypecastParenPad"/>
        <module name="WhitespaceAfter"/>
        <module name="WhitespaceAround"/>

        <!-- Modifier Checks                                    -->
        <!-- See https://checkstyle.org/config_modifiers.html -->
        <module name="ModifierOrder"/>
        <module name="RedundantModifier"/>

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

        <!-- Checks for common coding problems               -->
        <!-- See https://checkstyle.org/config_coding.html -->
        <module name="EmptyStatement"/>
        <module name="EqualsHashCode"/>
        <module name="IllegalInstantiation"/>
        <module name="InnerAssignment"/>
        <module name="MagicNumber"/>
        <module name="MissingSwitchDefault"/>
        <module name="NoFinalizer"/>
        <module name="MultipleVariableDeclarations"/>
        <module name="SimplifyBooleanExpression"/>
        <module name="SimplifyBooleanReturn"/>
        <module name="StringLiteralEquality"/>
        <module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/>
        <module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/>
        <module name="UnnecessarySemicolonInEnumeration"/>
        <module name="UnnecessarySemicolonInTryWithResources"/>
        <module name="UnusedLocalVariable"/>

        <!-- Checks for class design                         -->
        <!-- See https://checkstyle.org/config_design.html -->
        <module name="DesignForExtension"/>
        <module name="FinalClass"/>
        <module name="HideUtilityClassConstructor"/>
        <module name="InterfaceIsType"/>
        <module name="VisibilityModifier"/>

        <!-- Checks for metrics                            -->
        <!-- See https://checkstyle.org/config_metrics.html -->
        <module name="CyclomaticComplexity">
            <property name="max" value="10"/>
        </module>

        <!-- Miscellaneous other checks.                   -->
        <!-- See https://checkstyle.org/config_misc.html -->
        <module name="ArrayTypeStyle"/>
        <module name="FinalParameters"/>
        <module name="Indentation"/>
        <module name="TodoComment"/>
        <module name="UpperEll"/>

    </module>

</module>
