forked from phoedos/pmd
[jsp] 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.jsp.rule.basic;
|
||||
package net.sourceforge.pmd.lang.jsp.rule.codestyle;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
@ -2,7 +2,7 @@
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.jsp.rule.basic;
|
||||
package net.sourceforge.pmd.lang.jsp.rule.design;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.jsp.rule.basic;
|
||||
package net.sourceforge.pmd.lang.jsp.rule.security;
|
||||
|
||||
import net.sourceforge.pmd.lang.jsp.ast.ASTElExpression;
|
||||
import net.sourceforge.pmd.lang.jsp.ast.ASTElement;
|
@ -76,7 +76,7 @@ Do not use an attribute called 'class'. Use "styleclass" for CSS styles.
|
||||
since="3.6"
|
||||
message="Use JSP comments instead of HTML comments"
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_jsp_basic.html#nohtmlcomments">
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_jsp_bestpractices.html#nohtmlcomments">
|
||||
<description>
|
||||
In a production system, HTML comments increase the payload
|
||||
between the application server to the client, and serve
|
||||
@ -110,7 +110,7 @@ little other purpose. Consider switching to JSP comments.
|
||||
since="3.6"
|
||||
message="Do not do a forward from within a JSP file."
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_jsp_basic.html#nojspforward">
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_jsp_bestpractices.html#nojspforward">
|
||||
<description>
|
||||
Do not do a forward from within a JSP file.
|
||||
</description>
|
||||
|
@ -12,7 +12,7 @@ Rules which enforce a specific coding style.
|
||||
<rule name="DuplicateJspImports"
|
||||
since="3.7"
|
||||
message="Avoid duplicate imports such as ''{0}''"
|
||||
class="net.sourceforge.pmd.lang.jsp.rule.basic.DuplicateJspImportsRule"
|
||||
class="net.sourceforge.pmd.lang.jsp.rule.codestyle.DuplicateJspImportsRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_jsp_codestyle.html#duplicatejspimports">
|
||||
<description>
|
||||
Avoid duplicate import statements inside JSP's.
|
||||
|
@ -34,7 +34,7 @@ Externalized script could be reused between pages. Browsers can also cache the
|
||||
<rule name="NoInlineStyleInformation"
|
||||
since="3.6"
|
||||
message="Avoid having style information in JSP files."
|
||||
class="net.sourceforge.pmd.lang.jsp.rule.basic.NoInlineStyleInformationRule"
|
||||
class="net.sourceforge.pmd.lang.jsp.rule.design.NoInlineStyleInformationRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_jsp_design.html#noinlinestyleinformation">
|
||||
<description>
|
||||
Style information should be put in CSS files, not in JSPs. Therefore, don't use <B> or <FONT>
|
||||
|
@ -44,9 +44,9 @@ through SSL. See http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q261188
|
||||
|
||||
<rule name="NoUnsanitizedJSPExpression"
|
||||
since="5.1.4"
|
||||
class="net.sourceforge.pmd.lang.jsp.rule.basic.NoUnsanitizedJSPExpressionRule"
|
||||
class="net.sourceforge.pmd.lang.jsp.rule.security.NoUnsanitizedJSPExpressionRule"
|
||||
message="Using unsanitized JSP expression can lead to Cross Site Scripting (XSS) attacks"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_jsp_basic.html#nounsanitizedjspexpression">
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_jsp_security.html#nounsanitizedjspexpression">
|
||||
<description>
|
||||
Avoid using expressions without escaping / sanitizing. This could lead to cross site scripting - as the expression
|
||||
would be interpreted by the browser directly (e.g. "<script>alert('hello');</script>").
|
||||
|
@ -1,27 +0,0 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.jsp.rule.basic;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class BasicRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "jsp-basic";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "DuplicateJspImports");
|
||||
addRule(RULESET, "IframeMissingSrcAttribute");
|
||||
addRule(RULESET, "JspEncoding");
|
||||
addRule(RULESET, "NoClassAttribute");
|
||||
addRule(RULESET, "NoHtmlComments");
|
||||
addRule(RULESET, "NoInlineScript");
|
||||
addRule(RULESET, "NoInlineStyleInformation");
|
||||
addRule(RULESET, "NoJspForward");
|
||||
addRule(RULESET, "NoLongScripts");
|
||||
addRule(RULESET, "NoScriptlets");
|
||||
addRule(RULESET, "NoUnsanitizedJSPExpression");
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.jsp.rule.basicjsf;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class BasicJsfRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "jsp-basic-jsf";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "DontNestJsfInJstlIteration");
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.jsp.rule.bestpractices;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class BestPracticesRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "category/jsp/bestpractices.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "DontNestJsfInJstlIteration");
|
||||
addRule(RULESET, "NoClassAttribute");
|
||||
addRule(RULESET, "NoHtmlComments");
|
||||
addRule(RULESET, "NoJspForward");
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.jsp.rule.codestyle;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class CodeStyleRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "category/jsp/codestyle.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "DuplicateJspImports");
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.jsp.rule.design;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class DesignRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "category/jsp/design.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "NoInlineScript");
|
||||
addRule(RULESET, "NoInlineStyleInformation");
|
||||
addRule(RULESET, "NoLongScripts");
|
||||
addRule(RULESET, "NoScriptlets");
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.jsp.rule.errorprone;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class ErrorProneRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "category/jsp/errorprone.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "JspEncoding");
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.jsp.rule.security;
|
||||
|
||||
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
|
||||
|
||||
public class SecurityRulesTest extends SimpleAggregatorTst {
|
||||
|
||||
private static final String RULESET = "category/jsp/security.xml";
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
addRule(RULESET, "IframeMissingSrcAttribute");
|
||||
addRule(RULESET, "NoUnsanitizedJSPExpression");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user