-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pmd#3921 from oowekyala:issue3068-mock-rules-for-c…
…li-tests [java] Make cli tests use dummy rules pmd#3921
- Loading branch information
Showing
15 changed files
with
334 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/DummyJavaRule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html | ||
*/ | ||
|
||
package net.sourceforge.pmd.lang.java.rule; | ||
|
||
import java.util.List; | ||
|
||
import net.sourceforge.pmd.RuleContext; | ||
import net.sourceforge.pmd.lang.ast.Node; | ||
import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId; | ||
import net.sourceforge.pmd.lang.java.ast.JavaNode; | ||
|
||
/** | ||
* @author Clément Fournier | ||
*/ | ||
public class DummyJavaRule extends AbstractJavaRule { | ||
|
||
@Override | ||
public void apply(List<? extends Node> nodes, RuleContext ctx) { | ||
for (Node node : nodes) { | ||
apply(node, ctx); | ||
} | ||
} | ||
|
||
public void apply(Node node, RuleContext ctx) { | ||
|
||
} | ||
|
||
public static class DummyRuleOneViolationPerFile extends DummyJavaRule { | ||
|
||
@Override | ||
public void apply(Node node, RuleContext ctx) { | ||
ctx.addViolation(node); | ||
} | ||
} | ||
|
||
public static class DummyRulePrintsVars extends DummyJavaRule { | ||
|
||
@Override | ||
public void apply(Node node, RuleContext ctx) { | ||
((JavaNode) node).jjtAccept(this, ctx); | ||
} | ||
|
||
@Override | ||
public Object visit(ASTVariableDeclaratorId node, Object data) { | ||
asCtx(data).addViolation(node, node.getName()); | ||
return super.visit(node, data); | ||
} | ||
} | ||
} |
Oops, something went wrong.