- Upgraded to support Checkstyle 3.1 and bumped version to 2.0-SNAPSHOT

- Cleaned the plugin goals and logic
- Cleaned and updated the documentation


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113453 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol
2003-05-30 13:13:26 +00:00
parent eab06469da
commit 5ca66c564b
15 changed files with 798 additions and 298 deletions

View File

@@ -3,3 +3,4 @@ velocity.log
maven.log
.classpath
.project
build.properties

View File

@@ -1,129 +1,37 @@
<?xml version="1.0"?>
<!--
=============================================================================
Checkstyle plugin for Maven.
=============================================================================
-->
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:util="jelly:util"
xmlns:doc="doc">
<goal name="maven-checkstyle-plugin:register">
<doc:registerReport
name="Checkstyle"
pluginName="maven-checkstyle-plugin"
link="checkstyle-report"
description="Report on coding style conventions."/>
</goal>
<goal name="maven-checkstyle-plugin:deregister">
<doc:deregisterReport name="Checkstyle"/>
</goal>
<!--
========================================================================
Default goal.
========================================================================
-->
<goal name="checkstyle" description="Perform checkstyle checks"
prereqs="checkstyle:report"/>
<!-- ================================================================== -->
<!-- C H E C K S T Y L E -->
<!-- ================================================================== -->
<goal
name="maven-checkstyle-plugin:report"
description="Generate code convention conformance reports"
prereqs="checkstyle:check-license-file"/>
<goal
name="checkstyle:report">
<!--
========================================================================
Initializations.
========================================================================
-->
<goal name="checkstyle:init">
<j:if test="${sourcesPresent == 'true'}">
<ant:taskdef
name="checkstyle"
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
</ant:taskdef>
<attainGoal name="checkstyle:determine-properties" />
<!-- Create the directory for the checkstyle cache in case it doesn't exist already -->
<ant:dirname property="maven.checkstyle.cache.dir"
file="${maven.checkstyle.cache.file}"/>
<ant:mkdir dir="${maven.checkstyle.cache.dir}"/>
<ant:echo>Using ${checkstyleProperties} for checkstyle ...</ant:echo>
<ant:checkstyle
properties="${checkstyleProperties}"
failOnViolation="${maven.checkstyle.fail.on.violation}"
cacheFile="${maven.checkstyle.cache.file}">
<ant:fileset
dir="${pom.build.sourceDirectory}"
includes="${maven.checkstyle.includes}"
excludes="${maven.checkstyle.excludes}"/>
<ant:formatter type="xml" toFile="${maven.build.dir}/checkstyle-raw-report.xml"/>
<j:choose>
<j:when test="${maven.checkstyle.usefile}">
<ant:formatter type="plain"
toFile="${maven.build.dir}/checkstyle-raw-report.txt"/>
</j:when>
<j:otherwise>
<ant:formatter type="plain"/>
</j:otherwise>
</j:choose>
</ant:checkstyle>
<doc:jsl
input="${maven.build.dir}/checkstyle-raw-report.xml"
output="checkstyle-report.xml"
stylesheet="${plugin.resources}/checkstyle.jsl"
omitXmlDeclaration="true"
outputMode="xml"
prettyPrint="true"
/>
</j:if>
</goal>
<goal name="checkstyle:check-license-file"
description="Checks the existence of the LICENSE.txt file">
<attainGoal name="checkstyle:determine-properties" />
<j:scope>
<ant:property file="${checkstyleProperties}" />
<j:set var="headerFile" scope="parent">${checkstyle.header.file}</j:set>
</j:scope>
<util:file name="${headerFile}" var="header"/>
<j:choose>
<j:when test="${not(header.exists()) and not(empty(headerFile))}">
<ant:echo>
======================================================================
= W A R N I N G =
======================================================================
= Your project doesn't contain a header file specified as: =
= ${header}
= Checkstyle needs it to check the existence of the License in your =
= source files. If it can't find this file, it throws an error. =
= A temporary solution is to create an empty LICENSE.txt file. =
= Though, we recommend that you edit this License. =
======================================================================
</ant:echo>
</j:when>
<j:otherwise>
<attainGoal name="checkstyle:report"/>
</j:otherwise>
</j:choose>
</goal>
<goal name="checkstyle:determine-properties">
<!--
|
| If an explicit properties file is set then use that. If one isn't then
| we will look for the maven.checkstyle.type property as there aren't going
| to be that many different formats: gnu, turbine, sun.
|
-->
<!-- If an explicit config file is set then use that. If one isn't
then we will look for the maven.checkstyle.format property and
load the predefined config set. -->
<j:set var="checkstylePropertiesX" value="${maven.checkstyle.properties}X"/>
<j:choose>
<j:when test="${checkstylePropertiesX != 'X'}">
<j:set
@@ -133,9 +41,145 @@
<j:otherwise>
<j:set
var="checkstyleProperties"
value="${plugin.resources}/${maven.checkstyle.format}-checkstyle.properties"/>
value="${plugin.resources}/${maven.checkstyle.format}_checks.xml"/>
</j:otherwise>
</j:choose>
<ant:taskdef name="checkstyle"
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
<classpath>
<pathelement location="${plugin.getDependencyPath('checkstyle:checkstyle')}"/>
<pathelement location="${plugin.getDependencyPath('antlr:antlr')}"/>
<pathelement location="${plugin.getDependencyPath('regexp:regexp')}"/>
<pathelement location="${plugin.getDependencyPath('commons-beanutils:commons-beanutils')}"/>
<pathelement location="${plugin.getDependencyPath('commons-collections:commons-collections')}"/>
<pathelement location="${plugin.getDependencyPath('commons-logging:commons-logging')}"/>
</classpath>
</ant:taskdef>
</j:if>
</goal>
<!--
========================================================================
Check if license file is available, display warning if not and sets
the Ant "checkstyleShouldRun" property if the license file is
available.
========================================================================
-->
<goal name="checkstyle:license"
prereqs="checkstyle:init">
<j:if test="${sourcesPresent == 'true'}">
<util:file var="header" name="${maven.checkstyle.header.file}"/>
<j:choose>
<j:when test="${not(header.exists())}">
<ant:echo>
======================================================================
= W A R N I N G =
======================================================================
= Your project doesn't contain a header file specified as: =
= ${header}
= Checkstyle needs it to check the existence of the License in your =
= source files. If it can't find this file, it throws an error. =
= A temporary solution is to create an empty LICENSE.txt file. =
= Though, we recommend that you edit this License. =
======================================================================
</ant:echo>
</j:when>
<j:otherwise>
<ant:property name="checkstyleShouldRun" value="true"/>
</j:otherwise>
</j:choose>
</j:if>
</goal>
<!--
========================================================================
Generate a checkstyle report by running checkstyle on the project
source code.
========================================================================
-->
<goal name="checkstyle:report"
description="Perform checkstyle checks"
prereqs="checkstyle:init,checkstyle:license">
<j:if test="${checkstyleShouldRun}">
<!-- Create the directory for the checkstyle cache in case it doesn't
exist already -->
<ant:dirname property="maven.checkstyle.cache.dir"
file="${maven.checkstyle.cache.file}"/>
<ant:mkdir dir="${maven.checkstyle.cache.dir}"/>
<ant:echo>Using ${checkstyleProperties} for checkstyle ...</ant:echo>
<ant:checkstyle
config="${checkstyleProperties}"
failOnViolation="${maven.checkstyle.fail.on.violation}">
<property key="checkstyle.header.file"
file="${maven.checkstyle.header.file}"/>
<property key="checkstyle.cache.file"
file="${maven.checkstyle.cache.file}"/>
<ant:fileset dir="${pom.build.sourceDirectory}">
<ant:include name="${maven.checkstyle.includes}"/>
<ant:include name="${maven.checkstyle.excludes}"/>
</ant:fileset>
<ant:formatter type="xml"
toFile="${maven.build.dir}/checkstyle-raw-report.xml"/>
<j:choose>
<j:when test="${maven.checkstyle.usefile}">
<ant:formatter type="plain"
toFile="${maven.build.dir}/checkstyle-raw-report.txt"/>
</j:when>
<j:otherwise>
<ant:formatter type="plain"/>
</j:otherwise>
</j:choose>
</ant:checkstyle>
<doc:jsl
input="${maven.build.dir}/checkstyle-raw-report.xml"
output="checkstyle-report.xml"
stylesheet="${plugin.resources}/checkstyle.jsl"
omitXmlDeclaration="true"
outputMode="xml"
prettyPrint="true"/>
</j:if>
</goal>
<!--
========================================================================
Register a Checkstyle report to the "site" plugin.
========================================================================
-->
<goal name="maven-checkstyle-plugin:register">
<doc:registerReport
name="Checkstyle"
pluginName="checkstyle"
link="checkstyle-report"
description="Report on coding style conventions."/>
</goal>
<!--
========================================================================
Deregister a Checkstyle report to the "site" plugin.
========================================================================
-->
<goal name="maven-checkstyle-plugin:deregister">
<doc:deregisterReport name="Checkstyle"/>
</goal>
</project>

View File

@@ -1,15 +1,15 @@
# -------------------------------------------------------------------
# P L U G I N P R O P E R I E S
# P L U G I N P R O P E R T I E S
# -------------------------------------------------------------------
# Checkstyle plugin
# -------------------------------------------------------------------
maven.build.dir = ${basedir}/target
maven.checkstyle.includes = **/*.java
maven.checkstyle.excludes =
maven.checkstyle.fail.on.violation = false
maven.checkstyle.cache.file = ${maven.build.dir}/checkstyle-cachefile
maven.checkstyle.format = sun
maven.checkstyle.header.file = ${basedir}/LICENSE.txt
# If useFile is false then the checkstyle task will display violations
# on stdout.

View File

@@ -5,22 +5,29 @@
<pomVersion>3</pomVersion>
<id>maven-checkstyle-plugin</id>
<name>Maven Checkstyle Plug-in</name>
<currentVersion>1.1</currentVersion>
<currentVersion>2.0-SNAPSHOT</currentVersion>
<description/>
<shortDescription>Java Project Management Tools</shortDescription>
<shortDescription>Checkstyle Plug-in</shortDescription>
<url>http://maven.apache.org/reference/plugins/checkstyle/</url>
<siteDirectory>/www/maven.apache.org/reference/plugins/checkstyle/</siteDirectory>
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven/src/plugins-build/checkstyle/</connection>
<url>http://cvs.apache.org/viewcvs/maven/src/plugins-build/checkstyle/</url>
</repository>
<versions>
<version>
<id>1.1</id>
<name>1.1</name>
<tag>MAVEN_CHECKSTYLE_1_1</tag>
</version>
<version>
<id>2.0</id>
<name>2.0</name>
<tag>HEAD</tag>
</version>
</versions>
<developers>
<developer>
<name>dIon Gillard</name>
@@ -43,8 +50,8 @@
<developer>
<name>Vincent Massol</name>
<id>vmassol</id>
<email>vmassol@octo.com</email>
<organization>Octo Technology</organization>
<email>vmassol@pivolis.com</email>
<organization>Pivolis</organization>
<roles>
<role>Java Developer</role>
</roles>
@@ -55,71 +62,42 @@
<email>jason@zenplex.com</email>
<organization>Zenplex</organization>
<roles>
<role>Architect</role>
<role>Release Manager</role>
<role>Java Developer</role>
</roles>
</developer>
</developers>
<dependencies>
<dependency>
<id>antlr</id>
<version>2.7.1</version>
<jar>antlrall-2.7.1.jar</jar>
<properties>
<classloader>root</classloader>
</properties>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<id>checkstyle</id>
<version>2.3</version>
<properties>
<classloader>root</classloader>
</properties>
<groupId>checkstyle</groupId>
<artifactId>checkstyle</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-jsl</artifactId>
<version>20030211.143151</version>
<properties>
<classloader>root.maven</classloader>
</properties>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>20030211.142705</version>
<url>http://jakarta.apache.org/commons/jelly/libs/xml/</url>
<properties>
<classloader>root.maven</classloader>
</properties>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-util</artifactId>
<version>20030211.141939</version>
<url>http://jakarta.apache.org/commons/jelly/libs/util/</url>
<properties>
<classloader>root.maven</classloader>
</properties>
</dependency>
<dependency>
<id>regexp</id>
<groupId>regexp</groupId>
<artifactId>regexp</artifactId>
<version>1.2</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.3</version>
</dependency>
</dependencies>
<!-- Plugin properties -->
<!--
<properties>
<buildDir>${basedir}/target</buildDir>
<includes>**/*.java</includes>
<excludes></excludes>
<failOnViolation>false</failOnViolation>
<cachefile>${maven.build.dir}/checkstyle-cachefile</cachefile>
<format>sun</format>
</properties>
-->
</project>

View File

@@ -1,49 +0,0 @@
checkstyle.lcurly.type=nl
checkstyle.lcurly.method=nl
checkstyle.lcurly.other=nl
checkstyle.rcurly=alone
checkstyle.ignore.braces=no
checkstyle.ignore.importlength=yes
checkstyle.ignore.public.in.interface=no
checkstyle.ignore.whitespace=yes
checkstyle.ignore.whitespace.cast=yes
checkstyle.parent.pad=space
# TODO: Try to get the files ot match the default values
# default 80 maxlinelen
checkstyle.maxlinelen=250
# default 2000
checkstyle.maxfilelen=3000
# default 150 maxmethodlen
checkstyle.maxmethodlen=180
# default 150 maxmethodlen
checkstyle.maxconstructorlen=100
# default 7
checkstyle.maxparameters=13
checkstyle.pattern.member=^m_[a-z](_?[a-zA-Z0-9])*$
checkstyle.pattern.static=^c_[a-z](_?[a-zA-Z0-9])*$
checkstyle.pattern.const=^[A-Z](_?[A-Z0-9]+)*$
checkstyle.pattern.method=[a-z](_?[a-zA-Z0-9]+)*$
checkstyle.pattern.parameter=[a-z](_?[a-zA-Z0-9]+)*$
checkstyle.pattern.localvar=[a-z](_?[a-zA-Z0-9]+)*$
checkstyle.pattern.todo=xTODO:x
checkstyle.javadoc.scope=protected
checkstyle.javadoc.checkUnusedThrows=true
checkstyle.require.packagehtml=yes
checkstyle.allow.noauthor=no
checkstyle.allow.protected=yes
checkstyle.allow.package=no
checkstyle.allow.tabs=no
# These instantiations should be illegal, use the static constants instead.
checkstyle.illegalInstantiations=java.lang.Boolean

View File

@@ -0,0 +1,189 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.1//EN"
"http://www.puppycrawl.com/dtds/configuration_1_1.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">
<!-- Checks that a package.html file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
<module name="PackageHtml"/>
<!-- 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="TreeWalker">
<property name="cacheFile" value="${checkstyle.cache.file}"/>
<!-- ************************************************************** -->
<!-- Checks that are different from the sun coding conventions ones -->
<!-- ************************************************************** -->
<property name="tabWidth" value="4"/>
<module name="LeftCurly">
<property name="option" value="nl"/>
</module>
<module name="RightCurly">
<property name="option" value="alone"/>
</module>
<module name="MemberName">
<property name="format" value="^m_[a-z](_?[a-zA-Z0-9])*$"/>
</module>
<module name="StaticVariableName">
<property name="format" value="^c_[a-z](_?[a-zA-Z0-9])*$"/>
</module>
<module name="MethodName">
<property name="format" value="[a-z](_?[a-zA-Z0-9]+)*$"/>
</module>
<module name="ParameterName">
<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>
<!-- ************************************************************** -->
<!-- Default Sun coding conventions checks -->
<!-- ************************************************************** -->
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName"/>
<module name="PackageName"/>
<module name="TypeName"/>
<module name="LocalFinalVariableName"/>
<!-- Checks for Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<module name="Header">
<!-- The follow property value demonstrates the ability -->
<!-- to have access to ANT properties. In this case it uses -->
<!-- the ${basedir} property to allow Checkstyle to be run -->
<!-- from any directory within a project. -->
<property name="headerFile" value="${checkstyle.header.file}"/>
</module>
<!-- Following interprets the header file as regular expressions. -->
<!-- <module name="RegexpHeader"/> -->
<!-- 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="FileLength"/>
<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="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TabCharacter"/>
<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="NeedBraces"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<module name="AvoidInlineConditionals"/>
<module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
<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="GenericIllegalRegexp">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
</module>

View File

@@ -1,7 +0,0 @@
# Sample checkstyle properties file to use with maven to support the
# sun code conventions
#
# To use this file, place the following in your project.properties:
#
# maven.checkstyle.properties=${maven.home}/plugins/checkstyle/sun-code-conventions-checkstyle.properties
#

View File

@@ -0,0 +1,166 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.1//EN"
"http://www.puppycrawl.com/dtds/configuration_1_1.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">
<!-- Checks that a package.html file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
<module name="PackageHtml"/>
<!-- 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="TreeWalker">
<property name="cacheFile" value="${checkstyle.cache.file}"/>
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<!-- 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 Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<module name="Header">
<!-- The follow property value demonstrates the ability -->
<!-- to have access to ANT properties. In this case it uses -->
<!-- the ${basedir} property to allow Checkstyle to be run -->
<!-- from any directory within a project. -->
<property name="headerFile" value="${checkstyle.header.file}"/>
</module>
<!-- Following interprets the header file as regular expressions. -->
<!-- <module name="RegexpHeader"/> -->
<!-- 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="FileLength"/>
<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="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TabCharacter"/>
<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="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
<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="GenericIllegalRegexp">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
</module>

View File

@@ -1,39 +0,0 @@
#
# Checkstyle settings ... default turbine project code settings, these can be
# overridden in a project specific properties file.
#
checkstyle.lcurly.type = nl
checkstyle.lcurly.method = nl
checkstyle.lcurly.other = nl
checkstyle.rcurly = alone
#checkstyle.paren.pad = nospace
#checkstyle.allow.tabs = false
#checkstyle.allow.protected = false
#checkstyle.allow.package = false
#checkstyle.allow.no.author = false
checkstyle.tab.width = 4
checkstyle.ignore.maxlinelen = @version
checkstyle.maxfilelen = 2000
#checkstyle.maxlinelen = 80
#checkstyle.maxmethodlen = 150
#checkstyle.maxconstructorlen = 150
#checkstyle.ignore.importlength = false
#checkstyle.pattern.member = ^[a-z][a-zA-Z0-9]*$
checkstyle.pattern.publicmember = ^f[A-Z][a-zA-Z0-9]*$
#checkstyle.pattern.parameter = ^[a-z][a-zA-Z0-9]*$
#checkstyle.pattern.const = ^[A-Z]([A-Z0-9_]*[A-Z0-9])?$
#checkstyle.pattern.static = ^[a-z][a-zA-Z0-9]*$
#checkstyle.pattern.type = ^[A-Z][a-zA-Z0-9]*$
#checkstyle.pattern.method = ^[a-z][a-zA-Z0-9]*$
#checkstyle.pattern.localvar = ^[a-z][a-zA-Z0-9]*$
#checkstyle.javadoc.scope = private
#checkstyle.require.package.html = false
#checkstyle.ignore.imports = false
checkstyle.illegal.imports =
#checkstyle.ignore.whitespace = false
#checkstyle.ignore.cast.whitespace = false
#checkstyle.ignore.braces = false
#checkstyle.ignore.public.in.interface = false
checkstyle.header.file = LICENSE.txt
#checkstyle.header.regexp = false
checkstyle.header.ignoreline = 1,6

View File

@@ -0,0 +1,183 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.1//EN"
"http://www.puppycrawl.com/dtds/configuration_1_1.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">
<!-- Checks that a package.html file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
<module name="PackageHtml"/>
<!-- 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="TreeWalker">
<property name="cacheFile" value="${checkstyle.cache.file}"/>
<!-- ************************************************************** -->
<!-- Checks that are different from the sun coding conventions ones -->
<!-- ************************************************************** -->
<property name="tabWidth" value="4"/>
<module name="LeftCurly">
<property name="option" value="nl"/>
</module>
<module name="RightCurly">
<property name="option" value="alone"/>
</module>
<module name="LineLength">
<property name="ignorePattern" value="@version"/>
</module>
<module name="MemberName">
<property name="format" value="^f[A-Z][a-zA-Z0-9]*$"/>
</module>
<!-- ************************************************************** -->
<!-- Default Sun coding conventions checks -->
<!-- ************************************************************** -->
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<!-- Checks for Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<module name="Header">
<!-- The follow property value demonstrates the ability -->
<!-- to have access to ANT properties. In this case it uses -->
<!-- the ${basedir} property to allow Checkstyle to be run -->
<!-- from any directory within a project. -->
<property name="headerFile" value="${checkstyle.header.file}"/>
</module>
<!-- Following interprets the header file as regular expressions. -->
<!-- <module name="RegexpHeader"/> -->
<!-- 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="FileLength"/>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="EmptyForIteratorPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TabCharacter"/>
<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="NeedBraces"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<module name="AvoidInlineConditionals"/>
<module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
<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="GenericIllegalRegexp">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
</module>

View File

@@ -1 +0,0 @@
stylesheets

View File

@@ -6,6 +6,19 @@
</properties>
<body>
<release version="2.0" date="in CVS">
<action dev="vmassol" type="update">
Upgraded to Checkstyle 3.1.
</action>
<action dev="vmassol" type="update">
Updated documentation.
</action>
<action dev="vmassol" type="update">
Complete clean of the existing plugin.
</action>
</release>
<release version="1.1" date="2003-05-30">
<action dev="vmassol" type="add">
Added a new <code>maven.checkstyle.useFile</code> property.

View File

@@ -13,29 +13,19 @@
<tr>
<td>checkstyle</td>
<td>
This is the default goal of the plugin and simply has a pre-requisite
of the <code>checkstyle:check-license-file</code> goal.
This is the default goal of the plugin. It simply calls the
<code>checkstyle:report</code> goal.
</td>
</tr>
<tr>
<td>checkstyle:generate-report</td>
<td>checkstyle:report</td>
<td>
Generates an xml report from the source code showing how well the
code conforms to the <a href="http://checkstyle.sourceforge.net">Checkstyle</a>
code conforms to the
<a href="http://checkstyle.sourceforge.net">Checkstyle</a>
definitions defined by the project.
</td>
</tr>
<tr>
<td>checkstyle:check-license-file</td>
<td>
Checks the existence of the LICENSE.txt file that checkstyle uses
for ensuring the top of a source file has a valid license block.
<p>
If the license file exists, the <code>checkstyle:generate-report</code>
goal is attained.
</p>
</td>
</tr>
</table>
</section>
</body>

View File

@@ -9,9 +9,31 @@
<body>
<section name="Maven CheckStyle Plugin">
<p>
This plugin generates a nicely formatted checkstyle report so
This plugin generates a nicely formatted
<a href="http://checkstyle.sourceforge.net">Checkstyle</a> report so
code violations can be easily found and corrected.
</p>
</section>
<section name="News">
<table>
<tr>
<th>Date</th>
<th>Description</th>
</tr>
<tr>
<td>30 May 2003</td>
<td>
New development version 2.0 created. First cut at supporting
Checkstyle 3.1.
</td>
</tr>
<tr>
<td>30 May 2003</td>
<td>
Release of version 1.1 (compatible with Checkstyle 2.4).
</td>
</tr>
</table>
</section>
</body>
</document>

View File

@@ -33,23 +33,33 @@
exclude any files.
</td>
</tr>
<tr>
<td>maven.checkstyle.format</td>
<td>Yes</td>
<td>
Specifies what predefined check set to use. Available sets are
"sun" (for the Sun coding conventions), "turbine" and "avalon".
Default value is <code>sun</code>.
</td>
</tr>
<tr>
<td>maven.checkstyle.properties</td>
<td>Yes</td>
<td>
Specifies the location of the checkstyle properties that will be
used to check the source.
<p>
There is also a sample file shipped with maven of the Jakarta
<a href="http://jakarta.apache.org/turbine/">Turbine</a> project
coding style, which maven adheres to.
</p>
<p>For more information on checkstyle properties, please see the
<a href="http://checkstyle.sourceforge.net">CheckStyle Home Page</a>
</p>
<p>The default value is
<code>${plugin.dir}/core/sun-code-conventions-checkstyle.properties</code>.
</p>
used to check the source. Note that you will need to use this
property only if you don't want to use any of the predefined
formats (see <code>maven.checkstyle.format</code>).
</td>
</tr>
<tr>
<td>maven.checkstyle.header.file</td>
<td>Yes</td>
<td>
Specifies the location of the License file (a.k.a the header file)
that is used by Checkstyle to verify that source code has the
correct copyright. Default value is
<code>${basedir}/LICENSE.txt</code>
</td>
</tr>
<tr>