views:

122

answers:

2

Hi all,

I'm trying to use checkstyle for a java project but I can't seem to get it working properly:

While it apparently runs smoothly, the html report doesn't give any info per authors as it should, i.e. the authors table is empty.

The thing is I don't know how checkstyle identify an author. Does it look at the java doc tag @author ? at the class level or at the method level ?

The ant task I used is below:

<taskdef resource="checkstyletask.properties" classpath="${libs.dir}/checkstyle-all-5.0.jar"/>
<target name="checkstyle" description="Generates a report of code convention violations.">
        <mkdir dir="${checkstyle.dir}"/>
    <checkstyle config="${util.dir}/checkstyle/sun_checks.xml" failureProperty="checkstyle.failure" failOnViolation="false">
        <formatter type="xml" tofile="${checkstyle.dir}/checkstyle_report.xml"/>
        <fileset dir="${src.dir}" includes="**/*.java"/>
    </checkstyle>
  <xslt in="${checkstyle.dir}/checkstyle_report.xml" out="${checkstyle.dir}/checkstyle_report.html" style="${util.dir}/checkstyle/checkstyle-author.xsl"/>
</target>

Many thanks for your help

David

A: 

Hey David,

Note that I haven't tested this, I merely encountered something about the author tag when I was reading through the documentation of Checkstyle (after you mentioned testing it a while back!). From the documentation:

Checks Javadoc comments for class and interface definitions. By default, does not check for author or version tags. The scope to verify is specified using the Scope class and defaults to Scope.PRIVATE. To verify another scope, set property scope to one of the Scope constants. To define the format for an author tag or a version tag, set property authorFormat or versionFormat respectively to a regular expression.

and:

To configure the check for an @author tag:

<module name="JavadocType">
   <property name="authorFormat" value="\S"/>
</module>

Regards,

Bart (yes, the one you know!)

Bart Kiers
Hey Bart! good to see you here :-)Thanks, I did that already but still, it doesn't work. On the checkstyle official forum, people don't seem to know. The xslt to be used is actually a contribution and not part of the official release. I reckon there is a problem in there.. contacted the guy who wrote it, but no reply so far...
DavidM
Okay, well, I reckon you'll keep me posted... :) Talk to you tomorrow!
Bart Kiers
A: 

In the end, I gave up... contact the author of this contributed piece of code but no reply. Moved back to using the somewhat simpler schema checkstyle-simpler.xsl instead

DavidM