Browse Source

Added an optional target to generate a Checkstyle report.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195153 13f79535-47bb-0310-9956-ffa450edef68
pull/30/head
Jeremias Maerki 22 years ago
parent
commit
eec55ce391
3 changed files with 41 additions and 0 deletions
  1. 25
    0
      build.xml
  2. 10
    0
      checkstyle.cfg
  3. 6
    0
      checkstyle.header

+ 25
- 0
build.xml View File

@@ -169,6 +169,12 @@ Sometimes ant gives out this warnings, but the build is finished without any pro
<include name="fop.jar"/>
</fileset>
</path>
<path id="checkstylepath">
<fileset dir="lib">
<include name="checkstyle-all-*.jar"/>
</fileset>
</path>

<!-- =================================================================== -->
<!-- Initialization target -->
@@ -681,6 +687,25 @@ Sometimes ant gives out this warnings, but the build is finished without any pro
</java>
</target>

<!-- =================================================================== -->
<!-- Checkstyle -->
<!-- =================================================================== -->
<target name="checkstyle" depends="prepare" description="Runs Checkstyle for a code quality report">
<available property="checkstyle.available" classname="com.puppycrawl.tools.checkstyle.CheckStyleTask" classpathref="checkstylepath"/>
<fail message="Please put checkstyle-all-*.jar in the lib directory. Get it from http://checkstyle.sourceforge.net" unless="checkstyle.available"/>
<taskdef name="checkstyle" classname="com.puppycrawl.tools.checkstyle.CheckStyleTask" classpathref="checkstylepath"/>
<checkstyle properties="checkstyle.cfg" failonviolation="false">
<fileset dir="${src.dir}" includes="org/apache/fop/**/*.java"/>
<formatter type="plain" toFile="${build.dir}/checkstyle_report.txt"/>
<formatter type="xml" toFile="${build.dir}/checkstyle_report.xml"/>
</checkstyle>
<available property="checkstyle.stylesheet.available" file="checkstyle-noframes.xsl"/>
<antcall target="checkstyle-html"/>
</target>
<target name="checkstyle-html" if="checkstyle.stylesheet.available">
<style in="${build.dir}/checkstyle_report.xml" out="${build.dir}/checkstyle_report.html" style="checkstyle-noframes.xsl"/>
</target>
<!-- =================================================================== -->
<!-- Creates the distribution -->
<!-- =================================================================== -->

+ 10
- 0
checkstyle.cfg View File

@@ -0,0 +1,10 @@
checkstyle.allow.tabs = no
checkstyle.tab.width = 4
checkstyle.allow.noauthor = yes
checkstyle.maxlinelen = 100
checkstyle.javadoc.scope = protected
checkstyle.ignore.importlength = yes
checkstyle.ignore.whitespace.cast = yes
checkstyle.allow.protected = yes
checkstyle.header.file = checkstyle.header
checkstyle.header.regexp = yes

+ 6
- 0
checkstyle.header View File

@@ -0,0 +1,6 @@
/\*
\* \$Id.*\$
\* Copyright \(C\) [\d\-]*2002 The Apache Software Foundation. All rights reserved.
\* For details on use and redistribution please refer to the
\* LICENSE file included with these sources.
\*/

Loading…
Cancel
Save