Checkstyle
This plugin uses the
eponym SourceForge project
to analyze Java source files or any other text files:
HTML, XML, properties, ...
Declaration
<plugin name="checkstyle">
<attribute name="checkstyle.config" value="etc/checkstyle_el4ant_checks.xml"/>
<attribute name="checkstyle.properties" value="etc/checkstyle_el4ant.properties"/>
<attribute name="checkstyle.set.list" value="application,tests"/>
</plugin>
Warning:
checkstyle.config and
checkstyle.properties attributes are mandatory.
Usage
The target
checkstyle generates a report per module set. A module can be
registered in one or many sets thank to the
set attribute. Please read
details about module sets.
For more details about Checkstyle configuration files, please read the tool
documentation.
When used with the
website plugin, checkstyle reports are generated in the
website.directory and a report entry is added in project reports overview.
Targets
-
checkstyle generates reports for all module sets (checkstyle.set.list).
-
checkstyle.set generates the report for a specific set.
Attributes
Global
-
checkstyle.set.list is the module set list for which the checkstyle
target generates reports by default. Default value is the list of
known module sets.
-
checkstyle.config refers to the checkstyle XML configuration file. This
attribute is mandatory. No value by default.
-
checkstyle.properties refers to the property file used in the checkstyle
XML configuration file. This attribute is mandatory. No value by default.
ToDo
- Add a check for configuration attributes. Current state: if not set, the
user targets fail when calling them.
- Be able to use default properties and rules included in the plugin jar if
configuration attributes are not set by the user.
Known bugs
- The
checkstyle and checkstyle.set targets does not work from another
directory than the project directory if checkstyle configuration or
properties refer to other files relatively (a header for instance).
I think it is a bug of the checkstyle Ant task: it loads files from the
JVM current directory instead of using Ant relative file resolution.
- Checkstyle report generation does not output files properly with Jdk 1.5.
The project root directory is polluted.
- Checkstyle localization files are incorrects for french. As a result you
must work around the following failure:
IllegalArgumentException: can't parse argument number '' et ''
with a language setting in Ant script ANT_OPTS="-Duser.language=en"
Revision: r1.11 - 28 Oct 2005 - 13:11 - YvesMartin