beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremiah Johnson" <jerjo...@bea.com>
Subject checkstyle and code conventions
Date Tue, 07 Jun 2005 20:54:20 GMT
It looks to me like Struts is using the default rules for Checkstyle.
Here is the Struts Checkstyle task in build.xml:

    <target name="checkstyle" if="checkstyle.jar"
            description="Checks source code against Sun coding
guidelines"
            depends="init">
        <taskdef name="checkstyle"
 
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
            <classpath location="${checkstyle.jar}"/>
        </taskdef>
        <checkstyle>
            <formatter type="plain"/>
            <fileset dir="${src.share.dir}" includes="**/*.java"/>
        </checkstyle>
    </target>

Recent check-in comments give some clues to the pain involved: "Fix a
few hundred Checkstyle problems." and "Start fixing our myriad
Checkstyle errors. It seems we've become rather sloppy."

Heh.

Apache Jakarta defaults to Sun, but does appear open to defining other
conventions within a project
(http://jakarta.apache.org/site/source.html).  I am guessing that
Beehive would be related to Jakarta after incubation, so it may be a
good time to start addressing coding conventions.

I attached an example of the type of output Beehive might see if
Checkstyle becomes integrated.  This isn't a perfect example (because I
didn't exclude .svn directories and I used a v3.5 which doesn't support
Java 5), but I believe that by looking at the output you can get an idea
of the kind of stuff you might see.

To generate the attached, I used the following command:
Java -jar ~/tools/checkstyle-3.5/checkstyle-all-3.5.jar -c
~/tools/checkstyle-3.5/sun_checks.xml -r wsm/src -o wsm-checkstyle.txt

The developers need to decide if code conventions will be defined now or
later and then what they will be.  I think that you should bite this
bullet now - just after a release - rather than later which may
potentially be just before a release.

I think that you should modify the Sun conventions.  For example, here
is a suggested place to start (mods to
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html):
2.2: adjust the list to README.txt
3.1.1: adjust to the current ASF header
4: explicitly defined indentation as 4 spaces
6.3: change to wait to declare variable until block where used

- jeremiah

> -----Original Message-----
> From: Steven Tocco
> Sent: Monday, June 06, 2005 11:13 AM
> To: Beehive Developers
> Subject: RE: reformatting the wsm code
> 
> I think this is awesome.  Would love to see some energy around
> checkstyle (or similar tool).
> 
> One of the hardest parts about getting checkstyle rolled out is
getting
> agreement on the style xml config file, which enforces the rules via
reg
> expressions and other rules.  People get so excited about the
placement
> of braces in these types of discussions. :)
> 
> If I remember correctly it comes with an implementation of the Sun
> coding standard (which might be a little overboard).
> 
> Perhaps the struts one would be a good starting place?
> 
> Thoughts?
> 
> Thanks
> Steve



Mime
View raw message