LongVariable now has a pluggable parameter

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@3965 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2005-11-07 21:45:24 +00:00
parent 5908f2ebb0
commit 268d3b18b6
5 changed files with 21 additions and 8 deletions

View File

@ -17,9 +17,10 @@ Fixed bug 1313216 - Designer was not displaying 'final' attribute for ASTLocalVa
Fixed bug 1314086 - Added logging-jakarta-commons as a short name for rulesets/logging-jakarta-commons.xml to SimpleRuleSetNameMapper.
Implemented RFE 1311309 - Suppressed RuleViolation counts are now included in the reports.
Implemented RFE 1220371 - Rule violation suppression via annotations. Per the JLS, @SuppressWarnings can be placed before the following nodes: TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE.
Implemented RFE 1275547 - OverrideBothEqualsAndHashcode now skips Comparator implementations.
Applied patch 1306999 - Renamed CloseConnection to CloseResource and added support for checking Statement and ResultSet objects.
Renamed AvoidConcatenatingNonLiteralsInStringBuffer to InefficientStringBuffering; new name is a bit more concise.
Implemented RFE 1275547 - OverrideBothEqualsAndHashcode now skips Comparator implementations.
Modified LongVariable; now it has a property which can be used to override the minimum reporting value.
September 15, 2005 - 3.3:
New rules: PositionLiteralsFirstInComparisons (in the design ruleset), UnnecessaryLocalBeforeReturn (design ruleset), ProperLogger (logging-jakarta-commons ruleset), UselessOverridingMethod (basic ruleset), PackageCase (naming ruleset), NoPackage (naming ruleset), UnnecessaryCaseChange (strings ruleset)
@ -452,7 +453,7 @@ Added new ruleset: rulesets/imports.xml
Changed sorting of RuleViolations to group Files together.
Changed XML Renderer to improved format.
Created DVSL Stylesheet for the new format.
Moved the Cougaar rules out of the PMD core.
Moved the Cougaxar rules out of the PMD core.
Fixed bug 580093 - OverrideBothEqualsAndHashcodeRule reports a more correct line number.
Fixed bug 581853 - UnusedLocalVariableRule now handles anonymous inner classes correctly.
Fixed bug 580278 - this was a side effect of bug 581853.
@ -483,4 +484,4 @@ Added new HTML report format
June 25 2002 - 0.1:
Initial release
Using PMD? Get "PMD Applied", the book! http://pmdapplied.com/
Using PMD? Get "PMD Applied", the owner's manual! http://pmdapplied.com/

View File

@ -27,6 +27,14 @@ public class LongVariableRuleTest extends SimpleAggregatorTst {
});
}
public void testThreshold() {
rule.addProperty("minimum", "3");
runTests(new TestDescriptor[] {
new TestDescriptor(TEST6, "threshold test", 2, rule),
});
}
private static final String TEST1 =
"public class Foo {" + PMD.EOL +
" void foo(String argsWithExtraMustard) {} " + PMD.EOL +
@ -62,4 +70,10 @@ public class LongVariableRuleTest extends SimpleAggregatorTst {
" private int a23456789012345678;" + PMD.EOL +
"}";
private static final String TEST6 =
"public class Foo {" + PMD.EOL +
" private int a234;" + PMD.EOL +
" private int b234;" + PMD.EOL +
"}";
}

View File

@ -48,10 +48,11 @@ Detects when a field, formal or local variable is declared with a long name.
</description>
<priority>3</priority>
<properties>
<property name="minimum" description="The variable length reporting threshold" value="17"/>
<property name="xpath" pluginname="true">
<value>
<![CDATA[
//VariableDeclaratorId[string-length(@Image) > 17]
//VariableDeclaratorId[string-length(@Image) > $minimum]
]]>
</value>
</property>

View File

@ -8,9 +8,6 @@ import net.sourceforge.pmd.Report;
import net.sourceforge.pmd.RuleViolation;
import java.util.Iterator;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class TextRenderer implements Renderer {

View File

@ -144,7 +144,7 @@
<li>Will Sargent - AvoidThrowingCertainExceptionTypesRule, AvoidCatchingNPERule, ExceptionAsFlowControlRule, URL updates for 'Similar projects' page</li>
<li>Bertrand Mollinier Toublet - Bug report which led to platform character set encoding enhancement</li>
<li>Choi Ki Soo - Found bug in XMLRenderer</li>
<li>wedemann - Found bug in RuleSetFactory XPath message variable plugging</li>
<li>Gero Wedemann - Found bug in RuleSetFactory XPath message variable substitution</li>
<li>Adrian Papari - Wrote the PapariTextRenderer</li>
<li>Curt Cox - some additions to the 'Similar Projects' page</li>
<li>Michael Griffel - bug fix for XMLRenderer</li>