<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2013-2022 TU Dortmund
This file is part of AutomataLib, http://www.automatalib.net/.

Licensed 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"
        "https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
    Checkstyle-Configuration: AutomataLib & LearnLib Checkstyle
    Description: Default Checkstyle configuration for AutomataLib and LearnLib
-->
<module name="Checker">

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

    <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>

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

    <module name="FileTabCharacter"/>
    <module name="UniqueProperties"/>

    <module name="TreeWalker">

        <!-- Checks for Javadoc comments.                     -->
        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
        <module name="AtclauseOrder">
            <property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
        </module>
        <module name="JavadocStyle"/>
        <module name="NonEmptyAtclauseDescription"/>
        <module name="AbstractClassName"/>
        <module name="ClassTypeParameterName">
            <property name="format" value="^[A-Z][A-Z0-9]*$"/>
        </module>

        <!-- Checks for Naming Conventions.                  -->
        <!-- See http://checkstyle.sf.net/config_naming.html -->
        <module name="ConstantName"/>
        <module name="LocalFinalVariableName">
            <property name="format" value="^[a-zA-Z][a-zA-Z0-9]*$"/>
        </module>
        <module name="LocalVariableName">
            <property name="format" value="^[a-zA-Z][a-zA-Z0-9]*$"/>
        </module>
        <module name="MemberName"/>
        <module name="MethodName"/>
        <module name="MethodTypeParameterName">
            <property name="format" value="^[A-Z][A-Z0-9]*$"/>
        </module>
        <module name="InterfaceTypeParameterName">
            <property name="format" value="^[A-Z][A-Z0-9]*$"/>
        </module>
        <module name="PackageName"/>
        <module name="ParameterName">
            <property name="accessModifiers" value="public"/>
        </module>
        <module name="StaticVariableName">
            <property name="format" value="^[a-zA-Z][a-zA-Z0-9]*$"/>
        </module>
        <module name="TypeName"/>

        <!-- Checks for imports                              -->
        <!-- See http://checkstyle.sf.net/config_imports.html -->
        <module name="AvoidStarImport"/>
        <module name="AvoidStaticImport"/>
        <module name="IllegalImport"/>
        <module name="ImportOrder">
            <property name="groups" value="/^java\./,javax,*"/>
            <property name="ordered" value="true"/>
            <property name="separated" value="true"/>
        </module>
        <module name="RedundantImport"/>
        <module name="UnusedImports"/>

        <!-- Checks for Size Violations.                    -->
        <!-- See http://checkstyle.sf.net/config_sizes.html -->
        <module name="AnonInnerLength">
            <property name="max" value="100"/>
        </module>
        <module name="OuterTypeNumber"/>

        <!-- Checks for whitespace                               -->
        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
        <module name="GenericWhitespace"/>
        <module name="NoWhitespaceAfter"/>
        <module name="NoWhitespaceBefore"/>
        <module name="WhitespaceAfter"/>
        <module name="SingleSpaceSeparator">
            <property name="validateComments" value="true"/>
        </module>

        <!-- 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">
            <property name="allowInSwitchCase" value="true"/>
        </module>
        <module name="LeftCurly"/>
        <module name="NeedBraces"/>
        <module name="RightCurly">
            <property name="id" value="RightCurlySame"/>
            <property name="tokens"
                      value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/>
        </module>
        <module name="RightCurly">
            <property name="id" value="RightCurlyAlone"/>
            <property name="option" value="alone_or_singleline"/>
            <property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, INSTANCE_INIT"/>
        </module>

        <!-- Checks for common coding problems               -->
        <!-- See http://checkstyle.sf.net/config_coding.html -->
        <module name="CovariantEquals"/>
        <module name="DefaultComesLast"/>
        <module name="DeclarationOrder">
            <property name="ignoreModifiers" value="true"/>
        </module>
        <module name="EmptyStatement"/>
        <module name="EqualsHashCode"/>
        <module name="ExplicitInitialization"/>
        <module name="IllegalCatch">
            <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable"/>
        </module>
        <module name="IllegalThrows"/>
        <module name="InnerAssignment"/>
        <module name="MagicNumber">
            <property name="ignoreNumbers" value="-1, 0, 1, 2, 3"/>
            <property name="constantWaiverParentToken"
                      value="TYPECAST,METHOD_CALL,EXPR,ARRAY_INIT,UNARY_MINUS,UNARY_PLUS,ELIST,STAR,ASSIGN,PLUS,MINUS,DIV,LITERAL_NEW"/>
            <property name="ignoreHashCodeMethod" value="true"/>
        </module>
        <module name="MissingSwitchDefault"/>
        <module name="PackageDeclaration"/>
        <module name="ParameterAssignment"/>
        <module name="SimplifyBooleanExpression"/>
        <module name="SimplifyBooleanReturn"/>
        <module name="StringLiteralEquality"/>
        <module name="OneStatementPerLine"/>
        <module name="OverloadMethodsDeclarationOrder"/>

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

        <!-- Miscellaneous other checks.                   -->
        <!-- See http://checkstyle.sf.net/config_misc.html -->
        <module name="ArrayTypeStyle"/>
        <module name="CommentsIndentation"/>
        <module name="UpperEll"/>
        <module name="OuterTypeFilename"/>
        <module name="AvoidEscapedUnicodeCharacters">
            <property name="allowEscapesForControlCharacters" value="true"/>
            <property name="allowNonPrintableEscapes" value="true"/>
        </module>
    </module>
</module>
