Fixed bug in IfStmtsMustUseBracesRule; thx to Michael Sutherland for the report
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1499 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
Added new rules: ConstructorCallsOverridableMethodRule, AtLeastOneConstructorRule, JUnitAssertionsShouldIncludeMessageRule, DoubleCheckedLockingRule, ExcessivePublicCountRule
|
Added new rules: ConstructorCallsOverridableMethodRule, AtLeastOneConstructorRule, JUnitAssertionsShouldIncludeMessageRule, DoubleCheckedLockingRule, ExcessivePublicCountRule
|
||||||
The Ant task has been updated; if you set "verbose=true" full stacktraces are printed. Thx to Paul Roebuck for the suggestion.
|
The Ant task has been updated; if you set "verbose=true" full stacktraces are printed. Thx to Paul Roebuck for the suggestion.
|
||||||
Moved JUnit rules into their own package - "net.sourceforge.pmd.rules.junit".
|
Moved JUnit rules into their own package - "net.sourceforge.pmd.rules.junit".
|
||||||
|
Fixed bug 697187 - Problem with nested ifs
|
||||||
|
|
||||||
February 11, 2003 - 1.03
|
February 11, 2003 - 1.03
|
||||||
Added new rules: CyclomaticComplexityRule, AssignmentInOperandRule
|
Added new rules: CyclomaticComplexityRule, AssignmentInOperandRule
|
||||||
|
@ -28,6 +28,5 @@ public class EmptyCatchBlockRuleTest extends RuleTst {
|
|||||||
public void testEmptyTryAndFinally() throws Throwable {
|
public void testEmptyTryAndFinally() throws Throwable {
|
||||||
runTest("EmptyCatchBlock5.java", 0, new EmptyCatchBlockRule());
|
runTest("EmptyCatchBlock5.java", 0, new EmptyCatchBlockRule());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,12 +9,15 @@ import net.sourceforge.pmd.rules.IfStmtsMustUseBracesRule;
|
|||||||
|
|
||||||
public class IfStmtsMustUseBracesRuleTest extends RuleTst {
|
public class IfStmtsMustUseBracesRuleTest extends RuleTst {
|
||||||
|
|
||||||
|
public void testSimpleBad() throws Throwable {
|
||||||
public void test1() throws Throwable {
|
|
||||||
runTest("IfStmtsMustUseBraces1.java", 1, new IfStmtsMustUseBracesRule());
|
runTest("IfStmtsMustUseBraces1.java", 1, new IfStmtsMustUseBracesRule());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test2() throws Throwable {
|
public void testSimpleOK() throws Throwable {
|
||||||
runTest("IfStmtsMustUseBraces2.java", 0, new IfStmtsMustUseBracesRule());
|
runTest("IfStmtsMustUseBraces2.java", 0, new IfStmtsMustUseBracesRule());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testNexted() throws Throwable {
|
||||||
|
runTest("IfStmtsMustUseBraces3.java", 1, new IfStmtsMustUseBracesRule());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import java.util.List;
|
|||||||
public class PMD {
|
public class PMD {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param reader - an InputStream to the Java code to analyse
|
* @param reader - a Reader to the Java code to analyse
|
||||||
* @param ruleSet - the set of rules to process against the file
|
* @param ruleSet - the set of rules to process against the file
|
||||||
* @param ctx - the context in which PMD is operating. This contains the Renderer and whatnot
|
* @param ctx - the context in which PMD is operating. This contains the Renderer and whatnot
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +34,6 @@ public class IfStmtsMustUseBracesRule extends BracesRule {
|
|||||||
lineNumberOfLastViolation = node.getBeginLine();
|
lineNumberOfLastViolation = node.getBeginLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return super.visit(node, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
public class IfStmtsMustUseBraces2 {
|
public class IfStmtsMustUseBraces3 {
|
||||||
public void foo() {
|
public void foo() {
|
||||||
if (true) {
|
if (true) {
|
||||||
int x=2;
|
int x=2;
|
||||||
|
7
pmd/test-data/IfStmtsMustUseBraces3.java
Normal file
7
pmd/test-data/IfStmtsMustUseBraces3.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
public class IfStmtsMustUseBraces3 {
|
||||||
|
public void foo() {
|
||||||
|
if (true) {
|
||||||
|
if (true) bar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@
|
|||||||
<section name="Credits">
|
<section name="Credits">
|
||||||
<subsection name="Individuals">
|
<subsection name="Individuals">
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>Michael Sutherland - bug report</li>
|
||||||
<li>Andrew Glover - ExcessivePublicCountRule, CouplingBetweenObjectsRule, ExcessiveImportsRule, documentation tweaks</li>
|
<li>Andrew Glover - ExcessivePublicCountRule, CouplingBetweenObjectsRule, ExcessiveImportsRule, documentation tweaks</li>
|
||||||
<li>Egon Willighagen - pmd-web suggestion</li>
|
<li>Egon Willighagen - pmd-web suggestion</li>
|
||||||
<li>Carl Gilbert - DoubleCheckedLockingRule, ConstructorCallsOverridableMethodRule, bug reports, feature requests, and documentation improvements</li>
|
<li>Carl Gilbert - DoubleCheckedLockingRule, ConstructorCallsOverridableMethodRule, bug reports, feature requests, and documentation improvements</li>
|
||||||
|
Reference in New Issue
Block a user