PMDStat

PMDStat generates statistical HTML reports based on PMD scans and annotations from CVS repository. The original idea comes from QALab project but the aim of PMDStat is to avoid anonymity in determination of who broke given PMD rules.

PMDStat is open source software, licensed under the GNU General Public License (GPL), build in NetBenas 5.0. Uses Apache Jakarta Commons CLIXerces2 Java Parser and JFreeChart to generate charts.

To run PMDStat, you need Java version 1.5.0 or higher.

Sample report

As an example, here is the report on test data.

Quick start

First, download PMDStat.

CVS annotations

Check out a working copy of your project from CVS, for example, to directory WORKING_FILES and create a CVS annotations file.
Typically, the commands look like this:

    cd WORKING_FILES
    cvs checkout MODULE_NAME
    cvs annotate &> cvs.out

For more information, see CVS web site.

PMD report

Run PMD scans and save output in pmd.xml file. Command for Ant could look like this:

    <pmd rulesetfiles="${RULE_SET_FILE}" targetjdk="1.5">
            <formatter type="xml" toFile="pmd.xml" />
            <fileset dir="${WORKING_FILES}">
                <include name="**/*.java"/>
            </fileset>
    </pmd>

For more information, see PMD web site.

PMDStat

Data preparation

To prepare data from CVS and PMD run

    java sk.pmdstat.PMDStatPrepare -p WORKING_FILES cvs.out pmd.xml pmdstat.xml

For full options

    java sk.pmdstat.PMDStatPrepare -h

Report generation

To generate report run 

    java sk.pmdstat.PMDStatGenerate pmdstat.xml OUTPUT_DIRECTORY

For full options

    java sk.pmdstat.PMDStatGenerate -h

PMDStat Ant task

    <taskdef resource="tasks.properties">   
        <classpath>
            <pathelement location ="pmdstat.jar" />
            <pathelement location ="lib/xercesImpl.jar" />
            <pathelement location ="lib/jcommon-1.0.0.jar" />
            <pathelement location ="lib/jfreechart-1.0.1.jar" />
            <pathelement location ="lib/commons-cli-1.0.jar" />
        </classpath>
    </taskdef>

    <target name="pmdstat">
        <property name="pmd.out.file" value="pmd.xml" />
        <property name="cvs.out.file" value="cvs.out" />
        <property name="pmd.path" value="WORKING_FILES" />
        <property name="pmdstat.out.file" value="pmdstat.xml" />
        <property name="date.format" value="yyyy-mm-dd HH:MM:ss" />
        <property name="pmdstat.out.dir" value="OUTPUT_DIRECTORY" />
       
        <pmdstat-prepare
            dateformat="${date.format}"
            pmdpath="${pmd.path}"
            pmdfile="${pmd.out.file}"
            cvsfile="${cvs.out.file}"
            outputfile="${pmdstat.out.file}"
         />
       
        <pmdstat-generate
            title="PMDStat"
            dateformat="${date.format}"
            chartxsize="800"
            chartysize="600"
            numberofchecksback="5"
            inputfile="${pmdstat.out.file}"
            outputdir="${pmdstat.out.dir}"
         />
    </target>

Hosted by
SourceForge Logo