git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113253 13f79535-47bb-0310-9956-ffa450edef68
125 lines
3.2 KiB
XML
125 lines
3.2 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<ruleset name="Code Size Rules">
|
|
<description>
|
|
The Code Size Ruleset contains a collection of rules that find code size related problems.
|
|
</description>
|
|
|
|
|
|
<rule name="ExcessiveMethodLength"
|
|
message="Avoid really long methods."
|
|
class="net.sourceforge.pmd.rules.design.LongMethodRule">
|
|
<description>
|
|
Excessive Method Length usually means that the method is doing
|
|
too much. There is usually quite a bit of Cut and Paste there
|
|
as well. Try to reduce the method size by creating helper methods,
|
|
and removing cut and paste.
|
|
|
|
Default value is 2.5 sigma greater than the mean.
|
|
|
|
NOTE: In version 0.9 and higher, their are three parameters available:
|
|
minimum - Minimum Length before reporting.
|
|
sigma - Std Deviations away from the mean before reporting.
|
|
topscore - The Maximum Number of reports to generate.
|
|
|
|
At this time, only one can be used at a time.
|
|
|
|
</description>
|
|
<properties>
|
|
<property name="minimum" value="100"/>
|
|
</properties>
|
|
<example>
|
|
<![CDATA[
|
|
public void doSomething() {
|
|
System.out.println("I am a fish.");
|
|
System.out.println("I am a fish.");
|
|
System.out.println("I am a fish.");
|
|
System.out.println("I am a fish.");
|
|
System.out.println("I am a fish.");
|
|
// 495 copies omitted for brevity.
|
|
}
|
|
]]>
|
|
</example>
|
|
|
|
</rule>
|
|
|
|
|
|
<rule name="ExcessiveParameterList"
|
|
message="Avoid really long parameter lists."
|
|
class="net.sourceforge.pmd.rules.design.LongParameterListRule">
|
|
<description>
|
|
This checks to make sure that the Parameter Lists in the project aren't
|
|
getting too long. If there are long parameter lists, then that is
|
|
generally indicative that another object is hiding around there.
|
|
|
|
Basically, try to group the parameters together.
|
|
|
|
Default value is 2.5 sigma greater than the mean.
|
|
|
|
NOTE: In version 0.9 and higher, their are three parameters available:
|
|
minimum - Minimum Length before reporting.
|
|
sigma - Std Deviations away from the mean before reporting.
|
|
topscore - The Maximum Number of reports to generate.
|
|
|
|
At this time, only one can be used at a time.
|
|
|
|
</description>
|
|
<properties>
|
|
<property name="minimum" value="10"/>
|
|
</properties>
|
|
<example>
|
|
<![CDATA[
|
|
public void addData(
|
|
int p00, int p01, int p02, int p03, int p04, int p05,
|
|
int p05, int p06, int p07, int p08, int p09, int p10) {
|
|
|
|
}
|
|
}
|
|
]]>
|
|
</example>
|
|
|
|
</rule>
|
|
|
|
|
|
<rule name="ExcessiveClassLength"
|
|
message="Avoid really long Classes."
|
|
class="net.sourceforge.pmd.rules.design.LongClassRule">
|
|
<description>
|
|
Long Class files are indications that the class may be trying to
|
|
do too much. Try to break it down, and reduce the size to something
|
|
managable.
|
|
|
|
Default value is 2.5 sigma greater than the mean.
|
|
|
|
NOTE: In version 0.9 and higher, their are three parameters available:
|
|
minimum - Minimum Length before reporting.
|
|
sigma - Std Deviations away from the mean before reporting.
|
|
topscore - The Maximum Number of reports to generate.
|
|
|
|
At this time, only one can be used at a time.
|
|
|
|
</description>
|
|
<properties>
|
|
<property name="minimum" value="1000"/>
|
|
</properties>
|
|
<example>
|
|
<![CDATA[
|
|
public class Foo {
|
|
public void bar() {
|
|
// 500 lines of code
|
|
}
|
|
|
|
public void baz() {
|
|
// 500 more lines of code
|
|
}
|
|
}
|
|
]]>
|
|
</example>
|
|
</rule>
|
|
|
|
|
|
</ruleset>
|
|
|
|
|
|
|