I've been having a discussion on the help forum about
using the CheckMethodLengthRules. see
http://sourceforge.net/forum/forum.php?
thread_id=1226185&forum_id=188193
Based on some feedback from Tom Copeland, it
appears that the topscore property isn't working. From
my help article:
I originally ran with the minimum 1, topscore 6 values
from your sample file, and adding and removing the
topscore property made no difference. But I noticed
when I re-ran the rules this morning with the minimum
80, topscore 10 values, that I get slightly different results
e.g.
1. minimum 80, topscore 10 - "PMD found 2080 rule
violations in the code"
2. minimum 80 - "PMD found 2356 rule violations in the
code"
3. topscore 10 - "PMD found 1619 rule violations in the
code"
I was hoping that minimum 80, topscore 10 would give
me the 10 methods with the most lines in excess of 80,
but I'm guessing that's not what's happening.
<ruleset name="CheckMethodLengthRules"> </ruleset>
<description>
This ruleset checks for excessively long methods
</description>
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" message="This is one of the 10 longest methods">
<properties>
<property name="minimum" value="80">
<property name="topscore" value="10">
</property></property></properties>
</rule>
In case it makes a difference my build.xml to call the
rules looks like this:
=======================
<project name="CheckMethodLength" default="check_method_length">
<property environment="sysenv."> </property></project>
<property name="dir.server" value="${sysenv.SERVER_DIR}">
<property name="dir.tools.lib" value="../../lib"> </property></property>
<path id="user-content-pmd.classpath">
<fileset dir="${dir.tools.lib}">
<include name="pmd-2.3.jar">
<include name="saxpath-1.0-fcs.jar">
<include name="jaxen-core-1.0-fcs.jar">
</include></include></include></fileset>
</path>
<target name="check_method_length">
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath">
<pmd rulesetfiles="CheckMethodLength.xml" failonerror="true" failonruleviolation="true" printtoconsole="true">
<formatter type="html" tofile="MethodLengthReport.html">
<fileset dir="${dir.server}/components">
<include name="**/impl/*.java">
<include name="**/loaders/*.java">
</include></include></fileset>
</formatter></pmd>
</taskdef></target>
Paddy.
Logged In: YES
user_id=5159
This is still broken, and it makes these rules far less
useful. Yet I fear to dive into that code. Fear is,
indeed, the mindkiller...
Tom