diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt index 179e52d2b2..a1911c5a06 100644 --- a/pmd/etc/changelog.txt +++ b/pmd/etc/changelog.txt @@ -14,6 +14,8 @@ New rules: StrictExceptions : DoNotThrowExceptionInFinally Strings : AvoidStringBufferField +Rule upgrade: + CyclomaticComplexity now can be configure to display only classes average complexity or methods complexity, or both. 1.7 added as a valid option for targetjdk. New elements under : to match files exclude from processing, with to override. diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/codesize/xml/CyclomaticComplexity.xml b/pmd/regress/test/net/sourceforge/pmd/rules/codesize/xml/CyclomaticComplexity.xml index 281a8118cc..50ffb005bc 100644 --- a/pmd/regress/test/net/sourceforge/pmd/rules/codesize/xml/CyclomaticComplexity.xml +++ b/pmd/regress/test/net/sourceforge/pmd/rules/codesize/xml/CyclomaticComplexity.xml @@ -11,12 +11,8 @@ public class Foo { } ]]> - - - 2 - + + ]]> + + + + 2 + + + + + + false + 1 + + + + + + + false + 1 + + + \ No newline at end of file diff --git a/pmd/rulesets/codesize.xml b/pmd/rulesets/codesize.xml index 9976d0b14a..f7cec7e22a 100644 --- a/pmd/rulesets/codesize.xml +++ b/pmd/rulesets/codesize.xml @@ -112,19 +112,28 @@ public class Foo { - + + 3 + + + This rule uses the NCSS (Non Commenting Source Statements) algorithm to determine the number of lines -of code for a given method. NCSS ignores comments, and counts actual statements. Using this algorithm, +of code for a given method. NCSS ignores comments, and counts actual statements. Using this algorithm, lines of code that are split are counted as one. 3 @@ -239,11 +248,11 @@ lines of code that are split are counted as one. public class Foo extends Bar { public int methd() { super.methd(); - - - - - + + + + + //this method only has 1 NCSS lines return 1; } @@ -253,11 +262,11 @@ public class Foo extends Bar { This rule uses the NCSS (Non Commenting Source Statements) algorithm to determine the number of lines -of code for a given type. NCSS ignores comments, and counts actual statements. Using this algorithm, +of code for a given type. NCSS ignores comments, and counts actual statements. Using this algorithm, lines of code that are split are counted as one. 3 @@ -270,11 +279,11 @@ public class Foo extends Bar { public Foo() { //this class only has 6 NCSS lines super(); - - - - - + + + + + super.foo(); } } @@ -282,11 +291,11 @@ public class Foo extends Bar { This rule uses the NCSS (Non Commenting Source Statements) algorithm to determine the number of lines -of code for a given constructor. NCSS ignores comments, and counts actual statements. Using this algorithm, +of code for a given constructor. NCSS ignores comments, and counts actual statements. Using this algorithm, lines of code that are split are counted as one. 3 @@ -298,11 +307,11 @@ lines of code that are split are counted as one. public class Foo extends Bar { public Foo() { super(); - - - - - + + + + + //this constructor only has 1 NCSS lines super.foo(); } @@ -327,16 +336,16 @@ have more fine grained objects. -