forked from phoedos/pmd
Refactoring
This commit is contained in:
Sergey
committed by
Juan Martín Sotuyo Dodero
parent
c6cebde365
commit
49b2fb2e6a
@ -19,15 +19,15 @@ import net.sourceforge.pmd.lang.vf.ast.VfParserVisitorAdapter;
|
||||
public class VfRuleChainVisitor extends AbstractRuleChainVisitor {
|
||||
|
||||
protected void indexNodes(List<Node> nodes, RuleContext ctx) {
|
||||
VfParserVisitor jspParserVisitor = new VfParserVisitorAdapter();
|
||||
VfParserVisitor vfParserVisitor = new VfParserVisitorAdapter();
|
||||
|
||||
for (int i = 0; i < nodes.size(); i++) {
|
||||
jspParserVisitor.visit((ASTCompilationUnit) nodes.get(i), ctx);
|
||||
vfParserVisitor.visit((ASTCompilationUnit) nodes.get(i), ctx);
|
||||
}
|
||||
}
|
||||
|
||||
protected void visit(Rule rule, Node node, RuleContext ctx) {
|
||||
// Rule better either be a JspParserVisitor, or a XPathRule
|
||||
// Rule better either be a vfParserVisitor, or a XPathRule
|
||||
if (rule instanceof VfParserVisitor) {
|
||||
((VfNode) node).jjtAccept((VfParserVisitor) rule, ctx);
|
||||
} else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
# PMD JSP
|
||||
# PMD VF
|
||||
|
||||
Contains the PMD implementation to support Java Server Pages.
|
||||
Contains the PMD implementation to support Salesforce VisualForce.
|
||||
|
||||
For the available rules, see <a href="rules/index.html">rulesets index</a> page.
|
||||
|
@ -1,23 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xmlns="http://maven.apache.org/DECORATION/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 http://maven.apache.org/xsd/decoration-1.1.0.xsd"
|
||||
name="PMD JSP">
|
||||
<project xmlns="http://maven.apache.org/DECORATION/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 http://maven.apache.org/xsd/decoration-1.1.0.xsd"
|
||||
name="PMD VF">
|
||||
|
||||
<body>
|
||||
<menu ref="parent"/>
|
||||
<body>
|
||||
<menu ref="parent" />
|
||||
|
||||
<!-- The rulesets part of navigation will be added during pre-site and the
|
||||
list is build dynamically based on rulesets folder directory layout -->
|
||||
<!-- The rulesets part of navigation will be added during pre-site and
|
||||
the list is build dynamically based on rulesets folder directory layout -->
|
||||
|
||||
|
||||
<menu name="Rule Sets"/>
|
||||
<menu name="Rule Sets" />
|
||||
|
||||
|
||||
<!-- *********** -->
|
||||
<!-- *********** -->
|
||||
|
||||
<menu ref="reports"/>
|
||||
<menu ref="reports" />
|
||||
|
||||
</body>
|
||||
</body>
|
||||
</project>
|
||||
|
@ -39,9 +39,9 @@ public class VfParserTest {
|
||||
}
|
||||
|
||||
private Node parse(String code) {
|
||||
LanguageVersionHandler jspLang = LanguageRegistry.getLanguage(VfLanguageModule.NAME).getDefaultVersion()
|
||||
LanguageVersionHandler vfLang = LanguageRegistry.getLanguage(VfLanguageModule.NAME).getDefaultVersion()
|
||||
.getLanguageVersionHandler();
|
||||
Parser parser = jspLang.getParser(jspLang.getDefaultParserOptions());
|
||||
Parser parser = vfLang.getParser(vfLang.getDefaultParserOptions());
|
||||
Node node = parser.parse(null, new StringReader(code));
|
||||
return node;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public abstract class AbstractVfNodesTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the JSP parser on the source, and return the nodes of type clazz.
|
||||
* Run the VF parser on the source, and return the nodes of type clazz.
|
||||
*
|
||||
* @param clazz
|
||||
* @param source
|
||||
|
@ -52,7 +52,7 @@ public class VfPageStyleTest extends AbstractVfNodesTest {
|
||||
assertEquals("Correct expression content expected!", "\"'vf'\"", literal.getImage());
|
||||
}
|
||||
|
||||
private static final String VF_EL_EXPRESSION = "<html><title>Hello {!myBean.get(\"{! World }\") } .jsp</title></html>";
|
||||
private static final String VF_EL_EXPRESSION = "<html><title>Hello {!myBean.get(\"{! World }\") } .vf</title></html>";
|
||||
|
||||
private static final String VF_EL_EXPRESSION_IN_ATTRIBUTE = "<html> <f:validator type=\"get('type').{!myValidator.find(\"'vf'\")}\" /> </html>";
|
||||
|
||||
|
Reference in New Issue
Block a user