View Javadoc

1   package net.sourceforge.pmd.lang.rule;
2   
3   import java.util.List;
4   
5   import net.sourceforge.pmd.RuleContext;
6   import net.sourceforge.pmd.RulePriority;
7   import net.sourceforge.pmd.lang.Language;
8   import net.sourceforge.pmd.lang.ast.Node;
9   
10  /**
11   * This is a Rule implementation which can be used in scenarios where an actual
12   * functional Rule is not needed.  For example, during unit testing, or as
13   * an editable surrogate used by IDE plugins.  The Language of this Rule
14   * defaults to Java.
15   */
16  public class MockRule extends AbstractRule {
17  
18      public MockRule() {
19  	super();
20  	setLanguage(Language.JAVA);
21      }
22  
23      public MockRule(String name, String description, String message, String ruleSetName, RulePriority priority) {
24  	this(name, description, message, ruleSetName);
25  	setPriority(priority);
26      }
27  
28      public MockRule(String name, String description, String message, String ruleSetName) {
29  	super();
30  	setLanguage(Language.JAVA);
31  	setName(name);
32  	setDescription(description);
33  	setMessage(message);
34  	setRuleSetName(ruleSetName);
35      }
36  
37      public void apply(List<? extends Node> nodes, RuleContext ctx) {
38      }
39  }