-
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.
- Loading branch information
Showing
4 changed files
with
88 additions
and
24 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
37 changes: 37 additions & 0 deletions
37
pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/DummyJsRule.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,37 @@ | ||
/* | ||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html | ||
*/ | ||
|
||
package net.sourceforge.pmd.lang.ecmascript; | ||
|
||
import java.util.List; | ||
|
||
import net.sourceforge.pmd.RuleContext; | ||
import net.sourceforge.pmd.lang.ast.Node; | ||
import net.sourceforge.pmd.lang.ecmascript.rule.AbstractEcmascriptRule; | ||
|
||
/** | ||
* @author Clément Fournier | ||
*/ | ||
public class DummyJsRule extends AbstractEcmascriptRule { | ||
|
||
@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 DummyJsRule { | ||
|
||
@Override | ||
public void apply(Node node, RuleContext ctx) { | ||
ctx.addViolation(node); | ||
} | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
pmd-javascript/src/test/resources/rulesets/testing/js-rset1.xml
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,25 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="Test Ruleset" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> | ||
|
||
<description> | ||
Ruleset used by test RuleSetReferenceIdTest | ||
</description> | ||
|
||
<rule name="DummyRuleWithAViolationPerFile" | ||
language="ecmascript" | ||
since="1.0" | ||
message="Violation from test-rset-1.xml" | ||
class="net.sourceforge.pmd.lang.ecmascript.DummyJsRule$DummyRuleOneViolationPerFile"> | ||
<description> | ||
Just for test | ||
</description> | ||
<priority>3</priority> | ||
<example> | ||
<![CDATA[ | ||
]]> | ||
</example> | ||
</rule> | ||
|
||
</ruleset> |
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