<?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://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<!-- See http://checkstyle.sourceforge.net/checks.html for documentation on available checks -->
<module name="Checker">
   <!-- Checks to see if a file contains a tab character. -->
   <module name="FileTabCharacter">
      <property name="eachLine" value="true"/>
   </module>

   <!-- Checks for trailing whitespace. -->
   <module name="RegexpSingleline">
      <!-- \s matches whitespace character, $ matches end of line. -->
      <property name="format" value="\s+$"/>
      <property name="message" value="Line has trailing spaces."/>
   </module>

   <module name="TreeWalker">

      <!-- Checks for imports -->
      <module name="AvoidStarImport"/>
      <module name="RedundantImport"/>
      <module name="UnusedImports"/>

      <!-- Modifier Checks -->
      <module name="ModifierOrder"/>
      <module name="RedundantModifier"/>

      <!-- Checks for common coding problems -->
      <module name="EmptyStatement"/>
      <!-- Checks that classes that override equals() also override hashCode(). -->
      <module name="EqualsHashCode"/>
      <!-- Checks for illegal instantiations where a factory method is preferred. -->
      <module name="IllegalInstantiation"/>

      <!-- Checks that long constants are defined with an upper ell. -->
      <module name="UpperEll"/>
      <!-- This check makes sure that all package annotations are in the package-info.java file. -->
      <module name="PackageAnnotation"/>
      <!-- Checks that if a class defines a covariant method equals, then it defines method equals(java.lang.Object). -->
      <module name="CovariantEquals"/>
      <!-- Checks the style of array type definitions. -->
      <module name="ArrayTypeStyle"/>
      <!-- Make sure left curly braces are on the same line. -->
      <module name="LeftCurly">
         <property name="maxLineLength" value="100"/>
      </module>

      <module name="RightCurly"/>
      <module name="RightCurly">
         <property name="option" value="alone"/>
         <property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
      </module>
      <!-- Checks that there is no whitespace after certain tokens; e.g. "." and "!". -->
      <module name="NoWhitespaceAfter"/>
      <!-- Checks that there is no whitespace before certain tokens; e.g. "++" and ";". -->
      <module name="NoWhitespaceBefore"/>
      <!-- Checks that most tokens are surrounded by whitespace. RCURLY is omitted so we can do stuff like "new Thread(){...}.start()". -->
      <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, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
      </module>
      <!-- Ensure there is no space between the identifier of a method definition, constructor definition, method call, or constructor invocation and the left parenthesis of the parameter list. -->
      <module name="MethodParamPad"/>
      <!-- Ensure proper indentation. -->
      <module name="Indentation">
         <property name="basicOffset" value="3"/>
         <property name="caseIndent" value="3"/>
         <property name="throwsIndent" value="3"/>
         <property name="arrayInitIndent" value="3"/>
         <property name="lineWrappingIndentation" value="3"/>
      </module>

       <module name="IllegalImport">
           <property name="illegalPkgs" value="junit.framework"/>
       </module>

      <module name="WriteTag">
         <property name="tag" value="@author"/>
         <property name="tagSeverity" value="error"/>
         <property name="severity" value="ignore"/>
      </module>

      <!-- Sevntu checks, http://sevntu-checkstyle.github.io/sevntu.checkstyle/ -->
      <module name="DiamondOperatorForVariableDefinition"/>
      <module name="RequiredParameterForAnnotation">
         <property name="annotationName" value="Parameterized.Parameters"/>
         <property name="requiredParameters" value="name"/>
      </module>

   </module>
</module>
