<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
    "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
    "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">

<!--

  A Checkstyle configuration that checks the coding conventions of
  the Community OpenORB project (openorb.sourceforge.net)

  Many Apache Jakarta projects like
  Avalon or Turbine use very similar conventions.

  Interesting techniques in this configuration:
  - use property expansion to find the header file
  - multiple instantiation of the MethodLengthCheck for different Token types

  This configuration includes rules taken from

  the Java Language Specification at
  http://java.sun.com/docs/books/jls/second_edition/html/index.html

  the Sun Code Conventions at
  http://java.sun.com/docs/codeconv/

  the Javadoc guidelines at
  http://java.sun.com/j2se/javadoc/writingdoccomments/index.html

  the JDK Api documentation
  http://java.sun.com/j2se/docs/api/index.html

  the OpenORB coding conventions at
  http://jakarta.apache.org/turbine/common/code-standards.html

  some best practices

-->

<module name="Checker">

  <property name="basedir" value="${basedir}"/>

  <module name="TreeWalker">

    <!-- naming conventions, the CORBA spec includes method names with underscores so we allow them here -->
    <module name="ConstantName">           <property name="format" value="^[A-Z](_?[A-Z0-9]+)*$"/></module>
    <module name="MethodName">             <property name="format" value="^[a-z](_?[a-zA-Z0-9]+)*$"/></module>
    <module name="LocalFinalVariableName"> <property name="format" value="^[a-z](_?[a-zA-Z0-9]+)*$"/></module>
    <module name="LocalVariableName">      <property name="format" value="^[a-z](_?[a-zA-Z0-9]+)*$"/></module>
    <module name="MemberName">             <property name="format" value="^m_[a-z](_?[a-zA-Z0-9])*$"/></module>
    <module name="ParameterName">          <property name="format" value="^[a-z](_?[a-zA-Z0-9]+)*$"/></module>
    <module name="TypeName">               <property name="format" value="^[A-Z][a-zA-Z0-9]*$"/></module>
    <module name="StaticVariableName">     <property name="format" value="^s_[a-z](_?[a-zA-Z0-9])*$"/></module>
    <module name="PackageName">            <property name="format" value="^[a-z]+(\.[a-zA-Z_][a-zA-Z_0-9]*)*$"/></module>

    <!-- code layout -->
    <module name="LeftCurly">              <property name="option" value="nl"/></module>
    <module name="RightCurly">             <property name="option" value="alone"/></module>
    <module name="NeedBraces"/>
    <module name="OperatorWrap"/>

    <!-- whitespace settings -->
    <module name="NoWhitespaceAfter"/>
    <module name="NoWhitespaceBefore"/>
    <module name="WhitespaceAfter"/>
    <module name="WhitespaceAround"/>



    <!-- JavaDoc guidelines -->
    <!-- <module name="JavadocMethod"><property name="scope" value="protected"/></module> -->
    <!-- <module name="JavadocVariable"><property name="scope" value="protected"/></module> -->
    <module name="JavadocType">
      <property name="scope" value="protected"/>
      <property name="authorFormat" value="^.+$"/> <!-- don't require email to avoid spam -->
      <property name="versionFormat" value="^\$Revision.*\$$"/> <!-- CVS Keyword -->
    </module>



    <!-- JLS -->
    <module name="RedundantModifier"/>
    <module name="ModifierOrder"/>
    <module name="UpperEll"/>



    <!-- Api Doc -->

    <!-- override hashCode whenever you override equals() -->
    <module name="EqualsHashCode"/>

    <!-- don't create new instances of Boolean, use Boolean.TRUE/FALSE or Boolean.valueOf() instead -->
    <module name="IllegalInstantiation"><property name="classes" value="java.lang.Boolean"/></module>



    <!-- best practices -->

    <!-- don't allow empty blocks (in particular catch blocks) -->
    <module name="EmptyBlock"><property name="option" value="text"/></module>

    <!-- avoid inner assignments -->
    <module name="InnerAssignment"/>

    <!-- don't allow imports from the sun.* package hierarchy -->
    <module name="IllegalImport"/>

    <!-- don't allow public members except in private record like classes,
         the members have special names there -->
    <module name="VisibilityModifier"><property name="publicMemberPattern" value ="^f[a-zA-Z0-9]*$"/></module>

    <!-- simplify your code -->
    <module name="RedundantImport"/>
    <module name="UnusedImports"/>
    <module name="SimplifyBooleanExpression"/>
    <module name="SimplifyBooleanReturn"/>

    <!-- flag reminder comments -->
    <module name="TodoComment"/>

    <!-- enforce length limits, different settings for method and ctor length -->
    <module name="LineLength"><property name="max" value="100"/></module>
    <module name="MethodLength"><property name="tokens" value="METHOD_DEF"/><property name="max" value="300"/></module>
    <module name="MethodLength"><property name="tokens" value="CTOR_DEF"/><property name="max" value="500"/></module>
    <module name="FileLength"><property name="max" value="2800"/></module>

    <!-- don't allow tabs -->
    <module name="TabCharacter"/>

    <!-- enforce License Header -->
    <module name="Header"><property name="headerFile" value="${basedir}/../../tools/etc/LICENSE.txt"/></module>

  </module>

  <!-- enforce package documentation -->
  <module name="PackageHtml"/>

</module>
