]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added an optional target to generate a Checkstyle report.
authorJeremias Maerki <jeremias@apache.org>
Thu, 5 Sep 2002 15:53:56 +0000 (15:53 +0000)
committerJeremias Maerki <jeremias@apache.org>
Thu, 5 Sep 2002 15:53:56 +0000 (15:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195153 13f79535-47bb-0310-9956-ffa450edef68

build.xml
checkstyle.cfg [new file with mode: 0644]
checkstyle.header [new file with mode: 0644]

index f2de78ff4f4cc1a0f8309bb58cc1d477de21afed..c0219dcbfffdeb140f3e4655927427758b40d128 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -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                                            -->
   <!-- =================================================================== -->
diff --git a/checkstyle.cfg b/checkstyle.cfg
new file mode 100644 (file)
index 0000000..01342df
--- /dev/null
@@ -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
\ No newline at end of file
diff --git a/checkstyle.header b/checkstyle.header
new file mode 100644 (file)
index 0000000..bd80d3f
--- /dev/null
@@ -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.
+ \*/
\ No newline at end of file