You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/02/03 12:36:41 UTC

cvs commit: jakarta-cactus/docs/framework/xdocs changes.xml coding_conventions.xml

vmassol     02/02/03 03:36:41

  Modified:    build    build-servletapi.xml build.xml
               docs/framework/xdocs changes.xml coding_conventions.xml
  Log:
  added a checkstyle target to check coding conventions using the SourceForge Checkstyle tool (http://checkstyle.sf.net)
  
  Revision  Changes    Path
  1.32      +25 -0     jakarta-cactus/build/build-servletapi.xml
  
  Index: build-servletapi.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/build/build-servletapi.xml,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- build-servletapi.xml	16 Jan 2002 22:49:08 -0000	1.31
  +++ build-servletapi.xml	3 Feb 2002 11:36:41 -0000	1.32
  @@ -718,4 +718,29 @@
   
       </target>
   
  +    <!--
  +       ========================================================================
  +         Perform a code audit using CheckStyle.
  +       ========================================================================
  +    -->
  +    <target name="checkstyle" depends="init">
  +
  +        <taskdef name="checkstyle"
  +            classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"/>
  +
  +        <echo message="Errors are reported in ${out.root.dir}/checkstyle_servlet${servlet.api}.xml"/>
  +
  +        <checkstyle failOnViolation="false">
  +            <fileset dir="${src.java.servlet.dir}">
  +                <include name="**/*.java"/>
  +            </fileset>
  +            <fileset dir="${sample.build.dir}/servlet${servlet.api}">
  +                <include name="**/*.java"/>
  +            </fileset>
  +            <formatter type="xml"
  +                toFile="${out.root.dir}/checkstyle_servlet${servlet.api}.xml"/>
  +        </checkstyle>
  +
  +    </target>
  +
   </project>
  
  
  
  1.33      +54 -1     jakarta-cactus/build/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/build/build.xml,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- build.xml	10 Jan 2002 19:46:00 -0000	1.32
  +++ build.xml	3 Feb 2002 11:36:41 -0000	1.33
  @@ -664,4 +664,57 @@
       <target name="gump" depends="jar,sample,doc,site,tests,dist.gump">
       </target>
   
  -</project>
  +    <!--
  +       ========================================================================
  +         Perform a code audit using CheckStyle.
  +       ========================================================================
  +    -->
  +    <target name="checkstyle.22" depends="init" if="servlet22.jar.present">
  +
  +        <ant antfile="build/build-servletapi.xml" target="checkstyle">
  +            <property name="servlet.api" value="22"/>
  +            <property name="servlet.jar" value="${servlet22.jar}"/>
  +        </ant>
  +
  +    </target>
  +
  +    <target name="checkstyle.23" depends="init" if="servlet23.jar.present">
  +
  +        <ant antfile="build/build-servletapi.xml" target="checkstyle">
  +            <property name="servlet.api" value="23"/>
  +            <property name="servlet.jar" value="${servlet23.jar}"/>
  +        </ant>
  +
  +    </target>
  +
  +    <target name="checkstyle.share" depends="init">
  +
  +        <taskdef name="checkstyle"
  +            classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"/>
  +
  +        <mkdir dir="${out.root.dir}"/>
  +
  +        <echo message="Errors are reported in ${out.root.dir}/checkstyle_share.xml"/>
  +
  +        <checkstyle failOnViolation="false">
  +            <fileset dir="${src.java.share.dir}">
  +                <include name="**/*.java"/>
  +                <exclude name="**/*Aspect.java"/>
  +            </fileset>
  +            <fileset dir="${src.java.test.share.dir}">
  +                <include name="**/*.java"/>
  +            </fileset>
  +            <fileset dir="${src.java.ant.dir}">
  +                <include name="**/*.java"/>
  +            </fileset>
  +            <fileset dir="${sample.build.dir}/share">
  +                <include name="**/*.java"/>
  +            </fileset>
  +            <formatter type="xml" toFile="${out.root.dir}/checkstyle_share.xml"/>
  +        </checkstyle>
  +
  +    </target>
  +
  +    <target name="checkstyle" depends="checkstyle.share,checkstyle.22,checkstyle.23"/>
  +
  +</project>
  \ No newline at end of file
  
  
  
  1.80      +10 -0     jakarta-cactus/docs/framework/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/docs/framework/xdocs/changes.xml,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- changes.xml	20 Jan 2002 18:36:09 -0000	1.79
  +++ changes.xml	3 Feb 2002 11:36:41 -0000	1.80
  @@ -87,6 +87,16 @@
       </devs>
   
       <release version="1.3 in CVS">
  +      <action dev="VMA" type="update">
  +        Updated coding conventions and added target to Ant build file for
  +        automatic checking of conventions using
  +        <link href="checkstyle.sf.net">Checkstyle</link>.
  +      </action>
  +      <action dev="VMA" type="update">
  +        Reformatted all sources to be compliant with our coding conventions
  +        (checked using
  +        <link href="http://sf.net/projects/checkstyle">Checkstyle</link>).
  +      </action>
         <action dev="VMA" type="add" due-to="Sean Zhang" due-to-email="sean.zhang@verizon.com">
           New <link href="howto_ide_jbuilder5.html">JBuilder5 integration
           tutorial</link>.
  
  
  
  1.6       +46 -3     jakarta-cactus/docs/framework/xdocs/coding_conventions.xml
  
  Index: coding_conventions.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/docs/framework/xdocs/coding_conventions.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- coding_conventions.xml	9 Jan 2002 04:59:35 -0000	1.5
  +++ coding_conventions.xml	3 Feb 2002 11:36:41 -0000	1.6
  @@ -18,8 +18,8 @@
         <p>
           This document describes a list of coding conventions that are
           required for code submissions to the project. By default, the coding
  -        conventions for most Open Source Projects should follow the existing coding
  -        conventions in the code that you are working on. For example,
  +        conventions for most Open Source Projects should follow the existing
  +        coding conventions in the code that you are working on. For example,
           if the bracket is on the same line as the if statement, then you
           should write all your code to have that convention.
         </p>
  @@ -38,6 +38,25 @@
   
       </s1>
   
  +    <s1 title="How to apply ?">
  +
  +      <p>
  +        Having coding conventions is nice but having a way to ensure they are
  +        applied is even better ... :-)
  +      </p>
  +      <p>
  +        The Cactus Ant build file has a <code>checkstyle</code> target which
  +        performs coding conventions using the
  +        <link href="http://checkstyle.sf.net">Checkstyle</link> tool. Drop the
  +        Checkstyle jars in your <code>ANT_HOME/lib</code>, go in the
  +        <code>build/</code> directory and type <code>ant checkstyle</code>.
  +      </p>
  +      <p>
  +        Please run this target before committing any code.
  +      </p>
  +
  +    </s1>
  +
       <s1 title="Cactus specific coding conventions">
   
         <s2 title="1. Brackets">
  @@ -229,7 +248,7 @@
           </p>
   
   <source><![CDATA[
  -@version $Id: coding_conventions.xml,v 1.5 2002/01/09 04:59:35 ndlesiecki Exp $
  +@version $Id: coding_conventions.xml,v 1.6 2002/02/03 11:36:41 vmassol Exp $
   ]]></source>
   
         </s2>
  @@ -306,6 +325,30 @@
       }
   }
   ]]></source>
  +
  +      </s2>
  +
  +      <s2 title="13. Qualified imports">
  +
  +        <p>
  +          All <code>import</code> statements should containing the full class
  +          name of classes to import and should not use the <code>"*"</code>
  +          notation :
  +        </p>
  +        <p>
  +          An example :
  +        </p>
  +
  +<source><![CDATA[
  +// Correct
  +import java.util.Date;
  +import java.net.HttpURLConnection;
  +
  +// Not correct
  +import java.util.*;
  +import java.net.*;
  +]]></source>
  +
   
         </s2>
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>