[javascript] Move rules and tests to new packages
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.ecmascript.rule.basic;
|
||||
package net.sourceforge.pmd.lang.ecmascript.rule.bestpractices;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -14,7 +14,7 @@
|
||||
language="ecmascript"
|
||||
since="5.0.1"
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_ecmascript_controversial.html#avoidwithstatement">
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_ecmascript_bestpractices.html#avoidwithstatement">
|
||||
<description>Avoid using with - it's bad news</description>
|
||||
<priority>1</priority>
|
||||
<properties>
|
||||
@ -38,7 +38,7 @@ with (object) {
|
||||
<rule name="ConsistentReturn"
|
||||
since="5.0"
|
||||
message="A function should not mix 'return' statements with and without a result."
|
||||
class="net.sourceforge.pmd.lang.ecmascript.rule.basic.ConsistentReturnRule"
|
||||
class="net.sourceforge.pmd.lang.ecmascript.rule.bestpractices.ConsistentReturnRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_ecmascript_bestpractices.html#consistentreturn">
|
||||
<description>
|
||||
ECMAScript does provide for return types on functions, and therefore there is no solid rule as to their usage.
|
||||
|
@ -314,7 +314,7 @@ var z = ((1 + 1)); // Bad
|
||||
since="5.0"
|
||||
message="A ''return'', ''break'', ''continue'', or ''throw'' statement should be the last in a block."
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_codestyle_basic.html#unreachablecode">
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_ecmascript_codestyle.html#unreachablecode">
|
||||
<description>
|
||||
A 'return', 'break', 'continue', or 'throw' statement should be the last in a block. Statements after these
|
||||
will never execute. This is a bug, or extremely poor style.
|
||||
|
@ -1,25 +0,0 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.ecmascript.rule.basic;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class BasicRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "rulesets/ecmascript/basic.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "AssignmentInOperand");
|
||||
addRule(RULESET, "AvoidTrailingComma");
|
||||
addRule(RULESET, "ConsistentReturn");
|
||||
addRule(RULESET, "InnaccurateNumericLiteral");
|
||||
addRule(RULESET, "ScopeForInVariable");
|
||||
addRule(RULESET, "UnreachableCode");
|
||||
addRule(RULESET, "EqualComparison");
|
||||
addRule(RULESET, "GlobalVariable");
|
||||
addRule(RULESET, "UseBaseWithParseInt");
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.ecmascript.rule.bestpractices;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class BestPracticesRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "category/ecmascript/bestpractices.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "AvoidWithStatement");
|
||||
addRule(RULESET, "ConsistentReturn");
|
||||
addRule(RULESET, "GlobalVariable");
|
||||
addRule(RULESET, "ScopeForInVariable");
|
||||
addRule(RULESET, "UseBaseWithParseInt");
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.ecmascript.rule.braces;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class BracesRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "rulesets/ecmascript/braces.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "ForLoopsMustUseBraces");
|
||||
addRule(RULESET, "IfElseStmtsMustUseBraces");
|
||||
addRule(RULESET, "IfStmtsMustUseBraces");
|
||||
addRule(RULESET, "WhileLoopsMustUseBraces");
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.ecmascript.rule.codestyle;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class CodeStyleRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "category/ecmascript/codestyle.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "AssignmentInOperand");
|
||||
addRule(RULESET, "AvoidTrailingComma");
|
||||
addRule(RULESET, "ForLoopsMustUseBraces");
|
||||
addRule(RULESET, "IfElseStmtsMustUseBraces");
|
||||
addRule(RULESET, "IfStmtsMustUseBraces");
|
||||
addRule(RULESET, "NoElseReturn");
|
||||
addRule(RULESET, "UnnecessaryBlock");
|
||||
addRule(RULESET, "UnnecessaryParentheses");
|
||||
addRule(RULESET, "UnreachableCode");
|
||||
addRule(RULESET, "WhileLoopsMustUseBraces");
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.ecmascript.rule.controversial;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class ControversialRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "rulesets/ecmascript/controversial.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "AvoidWithStatement");
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.ecmascript.rule.errorprone;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class ErrorProneRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "category/ecmascript/errorprone.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "EqualComparison");
|
||||
addRule(RULESET, "InnaccurateNumericLiteral");
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.ecmascript.rule.unnecessary;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class UnnecessaryRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "rulesets/ecmascript/unnecessary.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "UnnecessaryBlock");
|
||||
addRule(RULESET, "UnnecessaryParentheses");
|
||||
addRule(RULESET, "NoElseReturn");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user