Revision: 41
Author:
mohit...@vedantatree.com
Date: Tue Apr 1 14:12:24 2014 UTC
Log: Integrating checkstyle
http://code.google.com/p/expressionoasis/source/detail?r=41
Added:
/trunk/config/checkstyle/checkstyle-checkstyle-project.xml
/trunk/config/checkstyle/checkstyle-sun-checks.xml
/trunk/config/checkstyle/import-control.xml
/trunk/config/checkstyle/java.header
/trunk/config/checkstyle/suppressions.xml
/trunk/docs/References.txt
Modified:
/trunk/build.gradle
/trunk/config/checkstyle/checkstyle.xml
=======================================
--- /dev/null
+++ /trunk/config/checkstyle/checkstyle-checkstyle-project.xml Tue Apr 1
14:12:24 2014 UTC
@@ -0,0 +1,225 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+ "
http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<module name="Checker">
+ <!--
+ If you set the basedir property below, then all reported file
+ names will be relative to the specified directory. See
+
http://checkstyle.sourceforge.net/5.x/config.html#Checker
+
+ <property name="basedir" value="${basedir}"/>
+ -->
+
+ <metadata name="com.atlas-sw.eclipse" value="I like Sydney"/>
+
+ <property name="severity" value="error"/>
+
+ <!--
+ <module name="SuppressionFilter">
+ <property name="file" value="${checkstyle.suppressions.file}"/>
+ </module>
+ -->
+
+ <module name="JavadocPackage">
+ <property name="allowLegacy" value="false"/>
+ </module>
+
+ <module name="Translation">
+ <property name="severity" value="ignore"/>
+ </module>
+
+ <module name="FileTabCharacter">
+ <property name="eachLine" value="false"/>
+ </module>
+
+ <module name="FileLength">
+ <property name="fileExtensions" value="java"/>
+ </module>
+
+ <module name="NewlineAtEndOfFile"/>
+
+ <!--
+ <module name="Header">
+ <property name="headerFile" value="${checkstyle.header.file}"/>
+ <property name="headerFile" value="java-header.txt"/>
+ <property name="fileExtensions" value="java"/>
+ <property name="id" value="header"/>
+ </module>
+ -->
+
+ <module name="RegexpSingleline">
+ <property name="format" value="\s+$"/>
+ <property name="minimum" value="0"/>
+ <property name="maximum" value="0"/>
+ </module>
+
+ <module name="TreeWalker">
+ <property name="tabWidth" value="4"/>
+
+ <module name="AvoidStarImport"/>
+ <module name="ConstantName"/>
+ <module name="EmptyBlock"/>
+ <module name="EmptyForIteratorPad"/>
+ <module name="EqualsHashCode"/>
+ <module name="OneStatementPerLine"/>
+
+ <!-- module name="IllegalCatch"/ -->
+ <!--
+ <module name="ImportControl">
+ <property name="file" value="${checkstyle.importcontrol.file}"/>
+ </module>
+ -->
+ <module name="IllegalImport"/>
+ <module name="IllegalInstantiation"/>
+ <module name="IllegalThrows"/>
+ <module name="InnerAssignment"/>
+ <module name="JavadocType">
+ <property name="authorFormat" value="\S"/>
+ </module>
+ <module name="JavadocMethod">
+ <property name="allowUndeclaredRTE" value="true"/>
+ <property name="allowThrowsTagsForSubclasses" value="true"/>
+ <property name="allowMissingPropertyJavadoc" value="true"/>
+ </module>
+ <module name="JavadocVariable"/>
+ <module name="JavadocStyle">
+ <property name="scope" value="public"/>
+ </module>
+
+ <module name="LeftCurly">
+ <property name="option" value="nl"/>
+ <property name="tokens" value="CLASS_DEF"/>
+ <property name="tokens" value="CTOR_DEF"/>
+ <property name="tokens" value="INTERFACE_DEF"/>
+ <property name="tokens" value="METHOD_DEF"/>
+ </module>
+ <module name="LeftCurly">
+ <property name="option" value="nlow"/>
+ <property name="tokens" value="LITERAL_CATCH"/>
+ <property name="tokens" value="LITERAL_DO"/>
+ <property name="tokens" value="LITERAL_ELSE"/>
+ <property name="tokens" value="LITERAL_FINALLY"/>
+ <property name="tokens" value="LITERAL_FOR"/>
+ <property name="tokens" value="LITERAL_IF"/>
+ <property name="tokens" value="LITERAL_SWITCH"/>
+ <property name="tokens" value="LITERAL_SYNCHRONIZED"/>
+ <property name="tokens" value="LITERAL_TRY"/>
+ <property name="tokens" value="LITERAL_WHILE"/>
+ </module>
+
+ <module name="OuterTypeNumber"/>
+ <module name="LineLength">
+ <property name="ignorePattern" value="^ *\* *[^ ]+$"/>
+ </module>
+ <module name="MethodCount">
+ <property name="maxTotal" value="30"/>
+ </module>
+
+ <module name="LocalFinalVariableName"/>
+ <module name="LocalVariableName"/>
+ <module name="MemberName">
+ <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
+ </module>
+ <module name="MethodLength"/>
+ <module name="MethodName"/>
+ <module name="MethodParamPad"/>
+ <module name="ModifierOrder"/>
+ <module name="NeedBraces"/>
+ <module name="NoWhitespaceAfter">
+ <property name="tokens" value="ARRAY_INIT"/>
+ <property name="tokens" value="BNOT"/>
+ <property name="tokens" value="DEC"/>
+ <property name="tokens" value="DOT"/>
+ <property name="tokens" value="INC"/>
+ <property name="tokens" value="LNOT"/>
+ <property name="tokens" value="UNARY_MINUS"/>
+ <property name="tokens" value="UNARY_PLUS"/>
+ </module>
+
+ <module name="NoWhitespaceBefore"/>
+ <module name="NoWhitespaceBefore">
+ <property name="tokens" value="DOT"/>
+ <property name="allowLineBreaks" value="true"/>
+ </module>
+
+ <module name="OperatorWrap"/>
+ <module name="OperatorWrap">
+ <property name="tokens" value="ASSIGN"/>
+ <property name="tokens" value="DIV_ASSIGN"/>
+ <property name="tokens" value="PLUS_ASSIGN"/>
+ <property name="tokens" value="MINUS_ASSIGN"/>
+ <property name="tokens" value="STAR_ASSIGN"/>
+ <property name="tokens" value="MOD_ASSIGN"/>
+ <property name="tokens" value="SR_ASSIGN"/>
+ <property name="tokens" value="BSR_ASSIGN"/>
+ <property name="tokens" value="SL_ASSIGN"/>
+ <property name="tokens" value="BXOR_ASSIGN"/>
+ <property name="tokens" value="BOR_ASSIGN"/>
+ <property name="tokens" value="BAND_ASSIGN"/>
+ <property name="option" value="eol"/>
+ </module>
+ <module name="PackageName"/>
+ <module name="ParameterName">
+ <property name="format" value="^a[A-Z][a-zA-Z0-9]*$"/>
+ </module>
+ <module name="ParameterNumber">
+ <property name="id" value="paramNum"/>
+ </module>
+ <module name="ParenPad"/>
+ <module name="TypecastParenPad"/>
+ <module name="RedundantImport"/>
+ <module name="RedundantModifier"/>
+ <module name="RightCurly">
+ <property name="option" value="alone"/>
+ </module>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+ <module name="StaticVariableName">
+ <property name="format" value="^s[A-Z][a-zA-Z0-9]*$"/>
+ </module>
+ <module name="TypeName"/>
+ <module name="UnusedImports"/>
+ <module name="UpperEll"/>
+ <module name="VisibilityModifier"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+ <module name="GenericWhitespace"/>
+ <module name="FinalClass"/>
+ <module name="MissingSwitchDefault"/>
+ <module name="MagicNumber"/>
+ <module name="Indentation">
+ <property name="basicOffset" value="4"/>
+ <property name="braceAdjustment" value="0"/>
+ <property name="caseIndent" value="0"/>
+ </module>
+ <module name="ArrayTrailingComma"/>
+ <module name="FinalLocalVariable"/>
+ <module name="EqualsAvoidNull"/>
+ <module name="ParameterAssignment"/>
+
+ <!-- Generates quite a few errors -->
+ <module name="CyclomaticComplexity">
+ <property name="severity" value="ignore"/>
+ </module>
+
+ <module name="NestedForDepth">
+ <property name="max" value="2"/>
+ </module>
+ <module name="NestedIfDepth">
+ <property name="max" value="3"/>
+ </module>
+ <module name="NestedTryDepth"/>
+ <module name="ExplicitInitialization"/>
+ <module name="AnnotationUseStyle"/>
+ <module name="MissingDeprecated"/>
+ <module name="MissingOverride">
+ <property name="javaFiveCompatibility" value="true"/>
+ </module>
+ <module name="PackageAnnotation"/>
+ <module name="SuppressWarnings"/>
+ <module name="OuterTypeFilename"/>
+ <module name="HideUtilityClassConstructor"/>
+ </module>
+</module>
=======================================
--- /dev/null
+++ /trunk/config/checkstyle/checkstyle-sun-checks.xml Tue Apr 1 14:12:24
2014 UTC
@@ -0,0 +1,177 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+ "
http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+
+ Checkstyle configuration that checks the sun coding conventions 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
+
+ - some best practices
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+
http://checkstyle.sf.net (or in your downloaded distribution).
+
+ Most Checks are configurable, be sure to consult the documentation.
+
+ To completely disable a check, just comment it out or delete it from the
file.
+
+ Finally, it is worth reading the documentation.
+
+-->
+
+<module name="Checker">
+ <!--
+ If you set the basedir property below, then all reported file
+ names will be relative to the specified directory. See
+
http://checkstyle.sourceforge.net/5.x/config.html#Checker
+
+ <property name="basedir" value="${basedir}"/>
+ -->
+
+ <!-- Checks that a package-info.java file exists for each package.
-->
+ <!-- See
http://checkstyle.sf.net/config_javadoc.html#JavadocPackage
-->
+ <module name="JavadocPackage"/>
+
+ <!-- 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"/>
+
+ <!-- Checks for Size Violations. -->
+ <!-- See
http://checkstyle.sf.net/config_sizes.html -->
+ <module name="FileLength"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See
http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="FileTabCharacter"/>
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See
http://checkstyle.sf.net/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
http://checkstyle.sf.net/config_header.html -->
+ <!-- <module name="Header"> -->
+ <!-- <property name="headerFile" value="${checkstyle.header.file}"/>
-->
+ <!-- <property name="fileExtensions" value="java"/> -->
+ <!-- </module> -->
+
+ <module name="TreeWalker">
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See
http://checkstyle.sf.net/config_javadoc.html -->
+ <module name="JavadocMethod"/>
+ <module name="JavadocType"/>
+ <module name="JavadocVariable"/>
+ <module name="JavadocStyle"/>
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See
http://checkstyle.sf.net/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
http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport"/>
+ <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+
+ <!-- Checks for Size Violations. -->
+ <!-- See
http://checkstyle.sf.net/config_sizes.html -->
+ <module name="LineLength"/>
+ <module name="MethodLength"/>
+ <module name="ParameterNumber"/>
+
+
+ <!-- Checks for whitespace -->
+ <!-- See
http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad"/>
+ <module name="GenericWhitespace"/>
+ <module name="MethodParamPad"/>
+ <module name="NoWhitespaceAfter"/>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="TypecastParenPad"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+
+
+ <!-- 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"/>
+ <module name="LeftCurly"/>
+ <module name="NeedBraces"/>
+ <module name="RightCurly"/>
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See
http://checkstyle.sf.net/config_coding.html -->
+ <module name="AvoidInlineConditionals"/>
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField"/>
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+ <module name="MagicNumber"/>
+ <module name="MissingSwitchDefault"/>
+ <module name="RedundantThrows"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+
+ <!-- Checks for class design -->
+ <!-- See
http://checkstyle.sf.net/config_design.html -->
+ <module name="DesignForExtension"/>
+ <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="ArrayTypeStyle"/>
+ <module name="FinalParameters"/>
+ <module name="TodoComment"/>
+ <module name="UpperEll"/>
+
+ </module>
+
+</module>
=======================================
--- /dev/null
+++ /trunk/config/checkstyle/import-control.xml Tue Apr 1 14:12:24 2014 UTC
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!DOCTYPE import-control PUBLIC
+ "-//Puppy Crawl//DTD Import Control 1.1//EN"
+ "
http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
+
+<import-control pkg="com.puppycrawl.tools.checkstyle">
+
+ <allow pkg="antlr"/>
+ <allow pkg="com.google.common.base"/>
+ <allow pkg="com.google.common.collect"/>
+ <allow pkg="com.puppycrawl.tools.checkstyle.api"/>
+ <allow pkg="
java.io"/>
+ <allow pkg="
java.net"/>
+ <allow pkg="java.nio"/>
+ <allow pkg="java.util"/>
+ <allow pkg="javax.xml.parsers"/>
+ <allow pkg="org.apache.commons.beanutils"/>
+ <allow pkg="org.apache.commons.logging"/>
+ <allow pkg="org.xml.sax"/>
+
+ <!-- The local ones -->
+ <allow class="java.security.MessageDigest" local-only="true"/>
+ <allow pkg="com.puppycrawl.tools.checkstyle.grammars" local-only="true"/>
+ <allow pkg="org.apache.commons.cli" local-only="true"/>
+ <allow pkg="org.apache.tools.ant" local-only="true"/>
+
+ <subpackage name="api">
+ <allow pkg="java.beans"/>
+ <allow pkg="java.lang.reflect"/>
+ <allow pkg="java.text"/>
+ <allow class="com.puppycrawl.tools.checkstyle.grammars.CommentListener"
+ local-only="true"/>
+ <allow
class="com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaTokenTypes"
+ local-only="true"/>
+ </subpackage>
+
+ <subpackage name="checks">
+ <allow pkg="com.puppycrawl.tools.checkstyle.checks"/>
+ <allow class="com.puppycrawl.tools.checkstyle.Defn"/>
+ <allow pkg="java.math"/>
+
+ <subpackage name="indentation">
+ <allow pkg="java.lang.reflect"/>
+ </subpackage>
+ <subpackage name="header">
+ <allow class="java.nio.charset.Charset" local-only="true"/>
+ </subpackage>
+ </subpackage>
+
+ <subpackage name="doclets">
+ <allow pkg="com.sun.javadoc"/>
+ </subpackage>
+
+ <subpackage name="filters">
+ <allow pkg="java.lang.ref"/>
+ </subpackage>
+
+ <subpackage name="gui">
+ <allow pkg="java.awt"/>
+ <allow pkg="javax.swing"/>
+ </subpackage>
+</import-control>
=======================================
--- /dev/null
+++ /trunk/config/checkstyle/java.header Tue Apr 1 14:12:24 2014 UTC
@@ -0,0 +1,18 @@
+/**
+ * Copyright (c) 2006 VedantaTree all rights reserved.
+ *
+ * This file is part of ExpressionOasis.
+ *
+ * ExpressionOasis is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * ExpressionOasis is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
License
+ * along with ExpressionOasis. If not, see
<
http://www.gnu.org/licenses/>.
+ */
=======================================
--- /dev/null
+++ /trunk/config/checkstyle/suppressions.xml Tue Apr 1 14:12:24 2014 UTC
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE suppressions PUBLIC
+ "-//Puppy Crawl//DTD Suppressions 1.1//EN"
+ "
http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
+
+<suppressions>
+ <suppress checks="FileLength"
+ files="TokenTypes.java"
+ lines="1"/>
+ <suppress checks="MagicNumber"
+ files="UnusedPrivateMethodCheck.java"
+ lines="176"/>
+ <suppress checks="ImportControl"
+ files="NewlineAtEndOfFileCheck.java"
+ lines="27"/>
+ <suppress checks="ImportControl"
+ files="TranslationCheck.java"
+ lines="24"/>
+ <suppress checks="ImportControl"
+ files="SuppressionCommentFilter.java"
+ lines="28"/>
+ <suppress checks="ImportControl"
+ files="SuppressWarningsFilter.java"
+ lines="24"/>
+ <suppress checks="ImportControl"
+ files="SuppressWithNearbyCommentFilter.java"
+ lines="28"/>
+ <suppress id="paramNum"
+ files="LocalizedMessage.java"
+ lines="141,148,181,213"/>
+
+ <!-- Tone down the checking for test code -->
+ <suppress checks="EmptyBlock" files=".*[\\/]src[\\/]test[\\/]"/>
+ <suppress checks="ImportControl" files=".*[\\/]src[\\/]test[\\/]"/>
+ <suppress checks="Javadoc" files=".*[\\/]src[\\/]test[\\/]"/>
+ <suppress checks="MagicNumber" files=".*[\\/]src[\\/]test[\\/]"/>
+ <suppress checks="MethodCount"
files="[\\/]IndentationCheckTest.java$"/>
+ <suppress checks="EqualsAvoidNull" files="[\\/]Int.*FilterTest.java$"/>
+
+ <!-- suppressions to remove over time -->
+ <suppress checks="FinalLocalVariable"
files=".*[\\/]src[\\/]test[\\/]"/>
+ <suppress checks="LineLength" files=".*[\\/]src[\\/]test[\\/]"/>
+ <suppress checks="Name" files=".*[\\/]src[\\/]test[\\/]"/>
+
+ <!--
+ Turn off all checks for Generated and Test code. Fixes issues with
using
+ Eclipse plug-in.
+ -->
+ <suppress checks="."
files=".*[\\/]grammars[\\/]Generated[a-zA-Z]*\.java"/>
+ <suppress checks="."
files=".*[\\/]grammars[\\/]Generated[a-zA-Z]*\.java"/>
+ <suppress checks="." files=".*[\\/]checkstyle[\\/]gui[\\/]"/>
+</suppressions>
=======================================
--- /dev/null
+++ /trunk/docs/References.txt Tue Apr 1 14:12:24 2014 UTC
@@ -0,0 +1,1 @@
+Checkstyle -
https://github.com/checkstyle/checkstyle
=======================================
--- /trunk/build.gradle Sat Mar 29 14:16:02 2014 UTC
+++ /trunk/build.gradle Tue Apr 1 14:12:24 2014 UTC
@@ -3,6 +3,7 @@
* use 'gradle javadoc' to generate the api docs in 'build/docs/javadoc'
folder
* use 'gradle test' to run the junit test cases
* use 'gradle build' to run the complete build
+* use 'gradle checkstyleMain to run checkstyle for code - on going
improvements for config file and code to keep in sync
* use 'gradle tasks' to see the available tasks
*/
@@ -11,6 +12,7 @@
// run 'gradle eclipse' command to generate eclipse project files
apply plugin: 'eclipse'
+// run 'gradle checkstyleMain
apply plugin: 'checkstyle'
sourceCompatibility = 1.7
@@ -40,6 +42,21 @@
//runtime files('lib/a.jar', 'lib/b.jar')
//compile files('lib/local-dependency.jar')
}
+
+
+//
--------------------------------------------------------------------------------
+
+// plugin for creating distribution
+// apply plugin: 'distribution'
+
+//distributions {
+// main {
+// baseName = 'someName'
+// contents {
+// from { 'src/readme' }
+// }
+// }
+//}
// To run the gradle build without installing gradle
//task wrapper(type: Wrapper) {
=======================================
--- /trunk/config/checkstyle/checkstyle.xml Sat Mar 29 14:16:02 2014 UTC
+++ /trunk/config/checkstyle/checkstyle.xml Tue Apr 1 14:12:24 2014 UTC
@@ -1,423 +1,176 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
- "
http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+ "
http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+
+ Checkstyle configuration that checks the sun coding conventions 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
+
+ - some best practices
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+
http://checkstyle.sf.net (or in your downloaded distribution).
+
+ Most Checks are configurable, be sure to consult the documentation.
+
+ To completely disable a check, just comment it out or delete it from the
file.
+
+ Finally, it is worth reading the documentation.
+
+-->
<module name="Checker">
+ <!--
+ If you set the basedir property below, then all reported file
+ names will be relative to the specified directory. See
+
http://checkstyle.sourceforge.net/5.x/config.html#Checker
- <!-- Checks that a package.html file exists for each package. -->
- <module name="PackageHtml"/>
+ <property name="basedir" value="${basedir}"/>
+ -->
- <!-- Checks whether files end with a new line. -->
+ <!-- Checks that a package-info.java file exists for each package.
-->
+ <!-- See
http://checkstyle.sf.net/config_javadoc.html#JavadocPackage
-->
+ <module name="JavadocPackage"/>
+
+ <!-- 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. -->
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See
http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>
+
+ <!-- Checks for Size Violations. -->
+ <!-- See
http://checkstyle.sf.net/config_sizes.html -->
+ <module name="FileLength"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See
http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="FileTabCharacter"/>
- <module name="TreeWalker">
+ <!-- Miscellaneous other checks. -->
+ <!-- See
http://checkstyle.sf.net/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>
- <!-- Javadoc for class/interface must be present/valid. -->
- <!-- Require author to be present. -->
- <module name="JavadocType">
- <property name="authorFormat" value="\S"/>
- </module>
+ <!-- Checks for Headers -->
+ <!-- See
http://checkstyle.sf.net/config_header.html -->
+ <!-- <module name="Header"> -->
+ <!-- <property name="headerFile" value="${checkstyle.header.file}"/>
-->
+ <!-- <property name="fileExtensions" value="java"/> -->
+ <!-- </module> -->
- <!-- Javadoc for methods must be present/valid. -->
- <module name="JavadocMethod">
- <property name="allowUndeclaredRTE" value="true"/>
- </module>
+ <module name="TreeWalker">
- <!-- Javadoc for class variables must be present/valid. -->
+ <!-- Checks for Javadoc comments. -->
+ <!-- See
http://checkstyle.sf.net/config_javadoc.html -->
+ <module name="JavadocMethod"/>
+ <module name="JavadocType"/>
<module name="JavadocVariable"/>
-
- <!-- Javadoc must be well-formed. -->
<module name="JavadocStyle"/>
- <!-- Naming conventions for packages. -->
- <module name="PackageName">
- <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
- </module>
- <!-- Naming conventions for classes and interfaces. -->
- <module name="TypeName"/>
-
- <!-- Naming conventions for constants. -->
- <!-- TODO: Problem with this is that it should cover basic -->
- <!-- types only, and not names like instance_ and logger_ etc. -->
- <!--
+ <!-- Checks for Naming Conventions. -->
+ <!-- See
http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName"/>
- -->
-
- <!-- Naming conventions for class variables. -->
- <module name="MemberName">
- <property name="format" value="^[a-z][a-zA-Z0-9]*_$"/>
- </module>
-
- <!-- Naming conventions local variables. -->
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
+ <module name="MemberName"/>
+ <module name="MethodName"/>
+ <module name="PackageName"/>
<module name="ParameterName"/>
+ <module name="StaticVariableName"/>
+ <module name="TypeName"/>
- <module name="StaticVariableName">
- <property name="format" value="^[a-z][a-zA-Z0-9]*_$"/>
- </module>
- <!-- Avoid start imports -->
+ <!-- Checks for imports -->
+ <!-- See
http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport"/>
-
- <!-- Avoid imports of the sun.* packages -->
- <module name="IllegalImport"/>
-
- <!-- Avoid redundant imports -->
+ <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
-
- <!-- Avoid unused imports -->
<module name="UnusedImports"/>
- <!-- Ensure certian import order -->
- <module name="ImportOrder">
- <property name="groups" value="java,javax"/>
- <property name="ordered" value="true"/>
- <property name="separated" value="true"/>
- </module>
- <!-- Lines should be maximum of 80 characters -->
- <module name="LineLength">
- <property name="max" value="80"/>
- </module>
+ <!-- Checks for Size Violations. -->
+ <!-- See
http://checkstyle.sf.net/config_sizes.html -->
+ <module name="LineLength"/>
+ <module name="MethodLength"/>
+ <module name="ParameterNumber"/>
- <!-- -->
- <module name="MethodParamPad"/>
- <!-- No whitespace after selected tokens -->
+ <!-- Checks for whitespace -->
+ <!-- See
http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad"/>
+ <module name="GenericWhitespace"/>
+ <module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
-
- <!-- -->
<module name="NoWhitespaceBefore"/>
-
- <!-- -->
- <module name="OperatorWrap">
- <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,
- LE,
- LITERAL_INSTANCEOF,
- LOR,
- LT,
- MINUS,
- MINUS_ASSIGN,
- MOD,
- MOD_ASSIGN,
- NOT_EQUAL,
- PLUS,
- PLUS_ASSIGN,
- QUESTION,
- SL,
- SL_ASSIGN,
- SR,
- SR_ASSIGN,
- STAR,
- STAR_ASSIGN"/>
- <property name="option" value="eol"/>
- </module>
-
- <!-- -->
+ <module name="OperatorWrap"/>
<module name="ParenPad"/>
+ <module name="TypecastParenPad"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
- <!-- No space in a case oparation "(int)" not "( int )" -->
- <module name="TypecastParenPad">
- <property name="option" value="nospace"/>
- </module>
- <!-- Avoid tab chacraters in the code -->
- <module name="TabCharacter"/>
-
- <!-- Space after comma, semicolon and casts -->
- <module name="WhitespaceAfter">
- <property name="tokens" value="COMMA,
- SEMI,
- TYPECAST"/>
- </module>
-
- <!-- Ensure whitespace around all operators other than -->
- <!-- GENERIC_START and GENERIC_END -->
- <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,
- RCURLY,
- SL,
- SLIST,
- SL_ASSIGN,
- SR,
- SR_ASSIGN,
- STAR,
- STAR_ASSIGN,
- TYPE_EXTENSION_AND,
- WILDCARD_TYPE"/>
- </module>
-
- <!-- Check modifier order: -->
- <!-- public | protected | private -->
- <!-- abstract -->
- <!-- static -->
- <!-- final -->
- <!-- transient | volatile -->
- <!-- synchronized -->
- <!-- native -->
- <!-- strictfp -->
+ <!-- Modifier Checks -->
+ <!-- See
http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
-
- <!-- Avoid redundant modifiers -->
<module name="RedundantModifier"/>
- <!-- Avoid empty blocks -->
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See
http://checkstyle.sf.net/config_blocks.html -->
+ <module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
+ <module name="LeftCurly"/>
+ <module name="NeedBraces"/>
+ <module name="RightCurly"/>
- <!-- Classes, interfaces and methods have left brace on a new line -->
- <module name="LeftCurly">
- <property name="option" value="nl"/>
- <property name="maxLineLength" value="80"/>
- <property name="tokens" value="CLASS_DEF,
- CTOR_DEF,
- INTERFACE_DEF,
- METHOD_DEF"/>
- </module>
- <!-- The others have left brace at eol -->
- <module name="LeftCurly">
- <property name="option" value="eol"/>
- <property name="maxLineLength" value="80"/>
- <property name="tokens" value="LITERAL_CATCH,
- LITERAL_DO,
- LITERAL_ELSE,
- LITERAL_FINALLY,
- LITERAL_FOR,
- LITERAL_IF,
- LITERAL_SWITCH,
- LITERAL_SYNCHRONIZED,
- LITERAL_TRY,
- LITERAL_WHILE"/>
- </module>
-
- <!-- TODO -->
- <module name="RightCurly">
- <property name="option" value="alone"/>
- <property name="tokens" value="LITERAL_CATCH,
- LITERAL_FINALLY,
- LITERAL_ELSE"/>
- </module>
-
- <!-- Avoid nested blocks other than in switch statements -->
- <module name="AvoidNestedBlocks">
- <property name="allowInSwitchCase" value="true"/>
- </module>
-
- <!-- Checks that classes that define a covariant equals() method -->
- <!-- also override method equals(java.lang.Object)
-->
- <module name="CovariantEquals"/>
-
- <!-- Avoid DCL as it doesn't work anyway -->
- <module name="DoubleCheckedLocking"/>
-
- <!-- Avoid empty statements -->
- <!-- TODO: Should be alloed in empty for-loop -->
+ <!-- Checks for common coding problems -->
+ <!-- See
http://checkstyle.sf.net/config_coding.html -->
+ <module name="AvoidInlineConditionals"/>
<module name="EmptyStatement"/>
-
- <!-- Checks that classes that override equals() -->
- <!-- also override hashCode() -->
<module name="EqualsHashCode"/>
-
- <!-- Checks that local variables and parameters that are never -->
- <!-- are declared final -->
- <!--
- <module name="FinalLocalVariable">
- <property name="tokens" value="PARAMETER_DEF,
- VARIABLE_DEF"/>
- </module>
- -->
-
- <!-- Check that method/constructor/catch block parameters are final -->
- <!--
- <module name="FinalParameters"/>
- -->
-
- <!-- Check that a name doens't hide another name -->
<module name="HiddenField"/>
-
- <!-- TODO
- <module name="IllegalTokenText">
- <property name="tokens" value="NUM_FLOAT,NUM_DOUBLE"/>
- </module>
- -->
-
- <!-- Avoid inner assignments -->
+ <module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
-
- <!-- Require default clause in switch statements -->
+ <module name="MagicNumber"/>
<module name="MissingSwitchDefault"/>
-
- <!-- Avoid modifying control variables -->
- <module name="ModifiedControlVariable"/>
-
- <!-- Avoid redundant throws -->
- <module name="RedundantThrows">
- <property name="allowUnchecked" value="true"/>
- </module>
-
- <!-- Require simple boolean expressions -->
+ <module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
-
- <!-- Require simple boolean expressions -->
<module name="SimplifyBooleanReturn"/>
- <!-- Capture string compare using == -->
- <module name="StringLiteralEquality"/>
-
- <!-- Checks that an overriding clone() method invokes super.clone() -->
- <module name="SuperClone"/>
-
- <!-- Checks that an overriding finalize() method invokes -->
- <!-- super.finalize() -->
- <module name="SuperFinalize"/>
-
- <!-- Disallow catcing exception base classes -->
- <module name="IllegalCatch"/>
-
- <!-- Disallow throwing exception base classes -->
- <module name="IllegalThrows"/>
-
- <!-- Require all classes to be in a package -->
- <module name="PackageDeclaration"/>
-
- <!-- Ensures correct layout of JUnit test cases -->
- <module name="JUnitTestCase"/>
-
- <!-- Enforce the following declaration order: -->
- <!-- 1. Class variables -->
- <!-- 2. Instance variables -->
- <!-- 3. Ctors -->
- <!-- 4. Methods -->
- <module name="DeclarationOrder"/>
-
- <!-- Disallow parameter assignment -->
- <module name="ParameterAssignment"/>
-
- <!-- Avoid explicit initialization to the default value -->
- <module name="ExplicitInitialization"/>
-
- <!-- Ensure the default clasue is the last case in a switch -->
- <module name="DefaultComesLast"/>
-
- <!-- Disallow non-commented swicth fall throug -->
- <module name="FallThrough"/>
-
- <!-- Each variable should be declared individually -->
- <module name="MultipleVariableDeclarations"/>
-
- <!-- Avoid unnecessary parantheses -->
- <module name="UnnecessaryParentheses"/>
-
- <!-- Make sure only static finals are public -->
- <module name="VisibilityModifier"/>
-
- <!-- Class with private constructor must be final -->
+ <!-- Checks for class design -->
+ <!-- See
http://checkstyle.sf.net/config_design.html -->
+ <module name="DesignForExtension"/>
<module name="FinalClass"/>
-
- <!-- Utility classes should have private ctor -->
<module name="HideUtilityClassConstructor"/>
+ <module name="InterfaceIsType"/>
+ <module name="VisibilityModifier"/>
- <!-- Require classes to be either abstract or final -->
- <module name="DesignForExtension"/>
- <!-- Ensures that exception classes are immutable -->
- <module name="MutableException"/>
-
- <!-- Flag overly complex constructions -->
- <module name="ClassFanOutComplexity"/>
- <module name="CyclomaticComplexity">
- <property name="max" value="20"/>
- </module>
- <module name="NPathComplexity"/>
-
- <!-- Trap trailing spaces -->
- <module name="GenericIllegalRegexp">
- <property name="format" value="\s+$"/>
- <property name="message" value="Line has trailing spaces."/>
- </module>
-
- <!-- Identify TODOs -->
- <module name="TodoComment">
- <property name="format" value="TODO"/>
- </module>
-
- <!-- Flag uncommented main() methods (debugging left-overs) -->
- <module name="UncommentedMain"/>
-
- <!-- Require long constants to be defined by uppercase L -->
- <module name="UpperEll"/>
-
- <!-- Array brackets on type not varaible -->
- <module name="ArrayTypeStyle"/>
-
- <!-- Indentations -->
- <module name="Indentation">
- <property name="basicOffset" value="2"/>
- <property name="braceAdjustment" value="0"/>
- <property name="caseIndent" value="2"/>
- </module>
-
- <!-- Avoid trailing comments -->
- <module name="TrailingComment"/>
+ <!-- Miscellaneous other checks. -->
+ <!-- See
http://checkstyle.sf.net/config_misc.html -->
+ <module name="ArrayTypeStyle"/>
+ <module name="FinalParameters"/>
+ <module name="TodoComment"/>
+ <module name="UpperEll"/>
</module>