diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt index 91590e4168..7d25db703a 100644 --- a/pmd/etc/changelog.txt +++ b/pmd/etc/changelog.txt @@ -10,6 +10,7 @@ Fixed bug 683465 - JavaCC parser no longer has ability to throw java.lang.Error; Fixed bug in OverrideBothEqualsAndHashcodeRule - it no longer bails out with a NullPtrException on interfaces that declare a method signature "equals(Object)". Thx to Don Leckie for catching that. Added an optional Ant task formatter attribute 'isReportFilePathAbsolute'. Thx to Andriy Rozeluk for the feedback. Added an optional Ant task attribute 'failOnRuleViolation'. This stops the build if any rule violations are found. +Moved several rules into a new "controversial" ruleset. January 22, 2003 - 1.02: Added new rules: ImportFromSamePackageRule, SwitchDensityRule, NullAssignmentRule, UnusedModifierRule, ForLoopShouldBeWhileLoopRule diff --git a/pmd/rulesets/basic.xml b/pmd/rulesets/basic.xml index e87531e0d5..3e36cacad5 100644 --- a/pmd/rulesets/basic.xml +++ b/pmd/rulesets/basic.xml @@ -212,22 +212,6 @@ public class JumbledIncrementerRule1 { - - - Unused modifiers are, well, unused. - - 3 - - - - - diff --git a/pmd/rulesets/controversial.xml b/pmd/rulesets/controversial.xml new file mode 100644 index 0000000000..c0e320c19f --- /dev/null +++ b/pmd/rulesets/controversial.xml @@ -0,0 +1,99 @@ + + + + +The Controversial Ruleset contains rules that, for whatever reason, are considered controversial. They +are separated out here to allow people to include as they see fit via custom rulesets. This ruleset was +initially created in response to discussions over UnnecessaryConstructorRule which Tom likes but +most people really dislike :-) + + + + + Unnecessary constructor detects when a constructor is not necessary; i.e., when there's only one constructor, + it's public, has an empty body, and takes no arguments. + + 3 + + + + + + + + + + Assigning a "null" to a variable (outside of its declaration) is usually in + bad form. Some times, the assignment is an indication that the programmer doesn't + completely understand what is going on in the code. NOTE: This sort of assignment + may in rare cases be useful to encourage garbage collection. If that's what you're using + it for, by all means, disregard this rule :-) + + 3 + + + + + + + + A method should have only one exit point, and that should be the last statement in the method. + + 3 + + + 0) { + return "hey"; // oops, multiple exit points! + } + return "hi"; + } + } + ]]> + + + + + + Unused modifiers are, well, unused. + + 3 + + + + + + + + + + diff --git a/pmd/rulesets/design.xml b/pmd/rulesets/design.xml index d056864437..32c04752f5 100644 --- a/pmd/rulesets/design.xml +++ b/pmd/rulesets/design.xml @@ -105,27 +105,6 @@ public class Foo { - - - A method should have only one exit point, and that should be the last statement in the method. - - 3 - - - 0) { - return "hey"; // oops, multiple exit points! - } - return "hi"; - } -} -]]> - - - - - - - - Assigning a "null" to a variable (outside of its declaration) is usually in - bad form. Some times, the assignment is an indication that the programmer doesn't - completely understand what is going on in the code. NOTE: This sort of assignment - may in rare cases be useful to encourage garbage collection. If that's what you're using - it for, by all means, disregard this rule :-) - - 3 - - diff --git a/pmd/rulesets/rulesets.properties b/pmd/rulesets/rulesets.properties index 5a67aed613..4668cf5c58 100644 --- a/pmd/rulesets/rulesets.properties +++ b/pmd/rulesets/rulesets.properties @@ -1 +1 @@ -rulesets.filenames=rulesets/strings.xml,rulesets/junit.xml,rulesets/braces.xml,rulesets/basic.xml,rulesets/unusedcode.xml,rulesets/design.xml,rulesets/naming.xml,rulesets/imports.xml,rulesets/codesize.xml \ No newline at end of file +rulesets.filenames=rulesets/strings.xml,rulesets/junit.xml,rulesets/braces.xml,rulesets/basic.xml,rulesets/unusedcode.xml,rulesets/design.xml,rulesets/naming.xml,rulesets/imports.xml,rulesets/codesize.xml,rulesets/controversial.xml \ No newline at end of file diff --git a/pmd/rulesets/unusedcode.xml b/pmd/rulesets/unusedcode.xml index b14e995cb8..f9cde3fc79 100644 --- a/pmd/rulesets/unusedcode.xml +++ b/pmd/rulesets/unusedcode.xml @@ -86,22 +86,6 @@ public class Foo { - - -Unnecessary constructor detects when a constructor is not necessary; i.e., when there's only one constructor, -it's public, has an empty body, and takes no arguments. - - 3 - - - -