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

<module name="Checker">

    <!-- Suppresses certain checks. -->
    <module name="SuppressionFilter">
        <property name="file" value="${checkstyle.suppressions.file}"/>
    </module>

    <!-- Checks that a package.html file exists for each package.     -->
    <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
    <module name="JavadocPackage">
        <property name="allowLegacy" value="true"/>
    </module>

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

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

    <module name="Header">
        <property name="header" value="/*\n * Copyright (c) 2019-2024 Ronald Brill.\n *\n * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"/>
    </module>

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

    <module name="LineLength">
        <property name="max" value="120"/>
        <property name="ignorePattern" value="^(package|import| *\* *[^ ]+).*"/>
    </module>

    <!-- Prevent two spaces after @xxxx -->
    <module name="RegexpSingleline">
        <property name="format" value="\* *@\w*  "/>
    </module>

    <module name="RegexpSingleline">
        <property name="format" value="\*\*/"/>
        <property name="message" value="Trailing two asterisks."/>
    </module>

    <module name="RegexpSingleline">
        <property name="format" value="\s$"/>
        <property name="message" value="Trailing whitespace found."/>
    </module>

    <module name="RegexpSingleline">
        <property name="format" value="\(value = (\w|\d)+\)"/>
        <property name="message" value="Unneeded 'value' literal."/>
    </module>

    <module name="RegexpMultiline">
        <property name="format" value="(?&lt;=\r?\n)\r?\n\r?\n"/>
        <property name="message" value="Two empty contiguous lines"/>
    </module>

    <module name="RegexpMultiline">
        <property name="format" value="package .*\r?\nimport"/>
        <property name="message" value="Package declaration should be followed by an empty line"/>
    </module>

    <module name="RegexpMultiline">
        <property name="format" value="\r?\n\r?\npackage"/>
        <property name="message" value="Package declaration should not be preceeded by an empty line"/>
    </module>

    <module name="RegexpSingleline">
        <property name="format" value="@JsxFunction\(\)|@JsxGetter\(\)|@JsxSetter\(\)|@JsxConstructor\(\)|@Alerts\(\)$"/>
        <property name="message" value="No need to specify parentheses"/>
    </module>

    <module name="RegexpSingleline">
        <property name="format" value="@Alerts$"/>
        <property name="message" value="No need to specify empty @Alerts"/>
    </module>

    <module name="RegexpSingleline">
        <property name="format" value="serialVersionUID"/>
        <property name="message" value="No need to specify serialVersionUID"/>
    </module>

    <module name="RegexpSingleline">
        <property name="format" value="\{ &quot;&quot; \}"/>
        <property name="message" value="No need for the curly brackets"/>
    </module>

    <module name="RegexpSingleline">
        <property name="format" value="@version"/>
    </module>

    <module name="RegexpSingleline">
        <property name="format" value="^(?!import).*BrowserVersionFeatures\.[A-Z]"/>
        <property name="message" value="Use static import for BrowserVersionFeatures"/>
    </module>

    <module name="RegexpMultiline">
        <property name="id" value="sysout"/>
        <property name="format" value="System\s*\.\s*(out)|(err)\s*\.\s*print(ln)?\("/>
        <property name="message" value="System.out.print/ln found"/>
    </module>

    <module name="TreeWalker">

        <property name="tabWidth" value="4"/>

        <module name="AnnotationUseStyle"/>

        <module name="LeftCurly">
            <property name="option" value="eol"/>
        </module>
        <module name="RightCurly">
            <property name="option" value="alone"/>
            <property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
        </module>

        <!-- Checks for Javadoc comments.                     -->
        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
        <module name="MissingJavadocMethod"/>
        <module name="MissingJavadocPackage"/>
        <module name="MissingJavadocType"/>

        <module name="JavadocMethod">
            <property name="accessModifiers" value="public, protected"/>
        </module>
        <module name="JavadocType">
            <property name="scope" value="protected"/>
            <property name="authorFormat" value="\S \S"/>
        </module>
        <module name="JavadocVariable">
            <property name="accessModifiers" value="protected"/>
        </module>
        <module name="JavadocStyle">
            <property name="scope" value="protected"/>
            <property name="checkFirstSentence" value="true"/>
            <property name="checkEmptyJavadoc" value="false"/>
            <property name="checkHtml" value="true"/>
        </module>
        <module name="InvalidJavadocPosition"/>
        <module name="JavadocContentLocation"/>
        <module name="JavadocLeadingAsteriskAlign" />
        <!--module name="JavadocMissingLeadingAsterisk"/-->
        <module name="JavadocMissingWhitespaceAfterAsterisk"/>
        <!--module name="JavadocParagraph"/-->
        <module name="JavadocTagContinuationIndentation"/>
        <module name="NonEmptyAtclauseDescription"/>
        <!--module name="RequireEmptyLineBeforeBlockTagGroup"/-->
        <module name="SingleLineJavadoc"/>

        <!-- Checks for Naming Conventions.                  -->
        <!-- See http://checkstyle.sf.net/config_naming.html -->
        <module name="CatchParameterName">
            <property name="format" value="^(ex?|ignored|expected)$"/>
        </module>
        <module name="LocalFinalVariableName"/>
        <module name="LocalVariableName"/>
        <module name="MethodName">
            <property name="format" value="^[a-zA-Z0-9]+|test[A-Z][a-zA-Z0-9_]+$"/>
        </module>
        <module name="PackageName"/>
        <module name="ParameterName"/>
        <module name="StaticVariableName">
            <property name="format" value="^[A-Z][a-zA-Z0-9_]+_$"/>
        </module>
        <module name="TypeName"/>
        <module name="MemberName">
            <property name="format" value="^[a-z][a-zA-Z0-9_]+_$"/>
        </module>
        <module name="ConstantName">
            <property name="format" value="log|^[A-Z][A-Z0-9_]*$"/>
        </module>

        <!-- Checks for imports                               -->
        <!-- See http://checkstyle.sf.net/config_imports.html -->
        <module name="AvoidStarImport"/>
        <module name="IllegalImport"/>
        <module name="RedundantImport"/>
        <module name="UnusedImports"/>

        <!-- Checks for whitespace                               -->
        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
        <module name="EmptyForInitializerPad">
            <property name="option" value="space"/>
        </module>
        <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"/>
        <module name="GenericWhitespace"/>
        <module name="ArrayTypeStyle"/>

        <!-- Checks for correct basic indentation                -->
        <!-- See http://checkstyle.sf.net/config_misc.html       -->
        <module name="Indentation"/>

        <!-- Modifier Checks                                    -->
        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
        <module name="ModifierOrder"/>
        <module name="RedundantModifier"/>

        <!-- Checks for blocks. You know, those {}'s         -->
        <!-- See http://checkstyle.sf.net/config_blocks.html -->
        <module name="AvoidNestedBlocks"/>
        <module name="EmptyBlock">
            <property name="option" value="text"/>
        </module>

        <module name="NeedBraces"/>
        <module name="AnnotationUseStyle">
            <property name="elementStyle" value="compact"/>
        </module>

        <!-- Checks for common coding problems               -->
        <!-- See http://checkstyle.sf.net/config_coding.html -->
        <module name="EmptyStatement"/>
        <module name="EqualsHashCode"/>
        <module name="HiddenField"/>
        <module name="IllegalInstantiation"/>
        <module name="InnerAssignment"/>
        <module name="MissingSwitchDefault"/>
        <module name="EqualsAvoidNull"/>
        <module name="MultipleVariableDeclarations"/>

        <module name="SimplifyBooleanReturn"/>
        <module name="SimplifyBooleanExpression"/>

        <module name="UnnecessaryParentheses">
            <property name="tokens" value="EXPR, IDENT, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, STRING_LITERAL, LITERAL_NULL, LITERAL_FALSE, LITERAL_TRUE, ASSIGN, BAND_ASSIGN, BOR_ASSIGN, BSR_ASSIGN, BXOR_ASSIGN, DIV_ASSIGN, MINUS_ASSIGN, MOD_ASSIGN, PLUS_ASSIGN, SL_ASSIGN, SR_ASSIGN, STAR_ASSIGN, LAMBDA, TEXT_BLOCK_LITERAL_BEGIN, UNARY_MINUS, UNARY_PLUS, INC, DEC, LNOT, BNOT, POST_INC, POST_DEC"/>
            <!-- LAND, LITERAL_INSTANCEOF, GT, LT, GE, LE, EQUAL, NOT_EQUAL -->
        </module>
        <module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/>
        <module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/>
        <module name="UnnecessarySemicolonInEnumeration"/>
        <module name="UnnecessarySemicolonInTryWithResources"/>

        <!-- module name="ParameterAssignment"/-->
        <module name="SuperFinalize"/>

        <!-- Checks for class design                         -->
        <!-- See http://checkstyle.sf.net/config_design.html -->
        <module name="FinalClass"/>
        <module name="HideUtilityClassConstructor"/>
        <module name="InterfaceIsType"/>
        <module name="VisibilityModifier"/>

        <!-- Miscellaneous other checks.                   -->
        <!-- See http://checkstyle.sf.net/config_misc.html -->

        <module name="UpperEll"/>
        <module name="OneStatementPerLine"/>

        <module name="FinalLocalVariable">
            <property name="tokens" value="VARIABLE_DEF,PARAMETER_DEF"/>
            <property name="validateEnhancedForLoopVariable" value="true"/>
        </module>
        <module name="MissingOverride"/>
    </module>
</module>