View Javadoc

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