diff --git a/docs/_data/sidebars/pmd_sidebar.yml b/docs/_data/sidebars/pmd_sidebar.yml index 22741aaf1b..247c6fae94 100644 --- a/docs/_data/sidebars/pmd_sidebar.yml +++ b/docs/_data/sidebars/pmd_sidebar.yml @@ -502,7 +502,7 @@ entries: url: /pmd_languages_visualforce.html output: web, pdf - title: Velocity Template Language (VTL) - url: /pmd_languages_vm.html + url: /pmd_languages_velocity.html output: web, pdf - title: XML and XML dialects url: /pmd_languages_xml.html diff --git a/docs/_plugins/jdoc_namespace_tag.rb b/docs/_plugins/jdoc_namespace_tag.rb index 88a85e7bbb..6e697fb948 100644 --- a/docs/_plugins/jdoc_namespace_tag.rb +++ b/docs/_plugins/jdoc_namespace_tag.rb @@ -104,7 +104,7 @@ class JDocNamespaceDeclaration < Liquid::Tag 'javascript', 'jsp', 'julia', 'kotlin', 'lang-test', 'lua', 'matlab', 'objectivec', 'perl', 'php', 'plsql', 'python', 'ruby', 'scala', 'swift', 'test', 'test-schema', 'tsql', 'ui', - 'modelica', 'visualforce', 'vm', 'xml'].flat_map {|m| [m, "pmd-" + m]} + 'modelica', 'visualforce', 'velocity', 'xml'].flat_map {|m| [m, "pmd-" + m]} def self.make_base_namespaces res = {} diff --git a/docs/pages/pmd/languages/velocity.md b/docs/pages/pmd/languages/velocity.md new file mode 100644 index 0000000000..d454aaed8f --- /dev/null +++ b/docs/pages/pmd/languages/velocity.md @@ -0,0 +1,18 @@ +--- +title: Velocity Template Language (VTL) support +permalink: pmd_languages_velocity.html +last_updated: February 2024 (7.0.0) +tags: [languages, PmdCapableLanguage, CpdCapableLanguage] +summary: "VTL-specific features and guidance" +--- + +> [Velocity](https://velocity.apache.org/engine/devel/vtl-reference.html) is a Java-based template engine. +> It permits web page designers to reference methods defined in Java code. + +{% include language_info.html name='Velocity Template Language (VTL)' id='velocity' implementation='velocity::lang.velocity.VmLanguageModule' supports_pmd=true supports_cpd=true since='5.1.0' %} + +{% capture id_change_note %} +The language id of the Velocity module was in PMD 6 just "vm". In PMD 7, this has been changed to "velocity". Also the +package name of the classes has been changed from vm to "velocity". +{% endcapture %} +{% include note.html content=id_change_note %} diff --git a/docs/pages/pmd/languages/vm.md b/docs/pages/pmd/languages/vm.md deleted file mode 100644 index 11f62468d1..0000000000 --- a/docs/pages/pmd/languages/vm.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Velocity Template Language (VTL) support -permalink: pmd_languages_vm.html -last_updated: September 2023 (7.0.0) -tags: [languages, PmdCapableLanguage, CpdCapableLanguage] -summary: "VTL-specific features and guidance" ---- - -> [Velocity](https://velocity.apache.org/engine/devel/vtl-reference.html) is a Java-based template engine. -> It permits web page designers to reference methods defined in Java code. - -{% include language_info.html name='Velocity Template Language (VTL)' id='vm' implementation='vm::lang.vm.VmLanguageModule' supports_pmd=true supports_cpd=true since='5.1.0' %} diff --git a/docs/pages/pmd/userdocs/migrating_to_pmd7.md b/docs/pages/pmd/userdocs/migrating_to_pmd7.md index 0255d60404..bbad4b0f5b 100644 --- a/docs/pages/pmd/userdocs/migrating_to_pmd7.md +++ b/docs/pages/pmd/userdocs/migrating_to_pmd7.md @@ -75,6 +75,7 @@ You might encounter additionally the following types of problems: * Some CLI options have been removed, because they have been deprecated. See [CLI Changes](#cli-changes) for details. * If you call CPD programmatically, the API has changed, see [New Programmatic API for CPD](pmd_release_notes_pmd7.html#new-programmatic-api-for-cpd). * If you use Visualforce, then you need to change "vf" to "visualforce", e.g. `category/vf/security.xml` ➡️ `category/visualforce/security.xml` +* If you use Velocity, then you need to change "vm" to "velocity", e.g. `category/vm/...` ➡️ `category/velocity/...` The following topics describe well known migration challenges in more detail. diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index f169f6bb7e..425493360e 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -136,6 +136,15 @@ is now considered stable. Experimental Kotlin support has been promoted as stable API now. +##### Changed: Velocity Template Language (VTL) + +The module was named just "vm" which was not a good name. It module and language id and +package names have been renamed to "velocity". + +If you import rules, you also need to ajdust the paths, e.g. + +* `category/vm/...` ➡️ `category/velocity/...` + #### Rule Changes **New Rules** @@ -153,6 +162,9 @@ Experimental Kotlin support has been promoted as stable API now. **Renamed Rulesets** * `category/vf/security.xml` ➡️ `category/visualforce/security.xml` +* `category/vm/bestpractices.xml` ➡️ `category/velocity/bestpractices.xml` +* `category/vm/design.xml` ➡️ `category/velocity/design.xml` +* `category/vm/errorprone.xml` ➡️ `category/velocity/errorprone.xml` **Removed Rules** @@ -371,6 +383,16 @@ in the migration guide for details. * The package `net.sourceforge.pmd.lang.vf` has been renamed to {%jdoc_package visualforce::lang.visualforce %}. * The language id of visualforce has been changed to `visualforce` (it was previously just "vf") * The ruleset changed: `category/vf/security.xml` ➡️ `category/visualforce/security.xml` +* pmd-velocity (renamed from pmd-vm) + * The package `net.sourceforge.pmd.lang.vm` has been renamed to {%jdoc_package velocity::lang.velocity %}. + * The language id of the Velocity module has been changed to `velocity` (it was previously just "vm") + * The rulesets changed: `category/vm/...` ➡️ `category/velocity/...` + * Many classes used the prefix `Vm`, e.g. `VmLanguageModule`. This has been changed to be `Vtl`: + * {%jdoc velocity::lang.velocity.VtlLanguageModule %} + * {%jdoc velocity::lang.velocity.ast.VtlNode %} + * {%jdoc velocity::lang.velocity.ast.VtlParser %} + * {%jdoc velocity::lang.velocity.cpd.VtlCpdLexer %} + * {%jdoc velocity::lang.velocity.rule.AbstractVtlRule %} **Internalized classes and interfaces and methods** @@ -716,10 +738,10 @@ The annotation `@DeprecatedUntil700` has been removed. * {%jdoc !!visualforce::lang.vf.DataType %} - method `fromBasicType(BasicType)` has been removed. Use {%jdoc visualforce::lang.vf.DataType#fromTypeName(java.lang.String) %} instead. * pmd-vm - * {%jdoc !!vm::lang.vm.ast.VmNode %} - method `jjtAccept()` has been removed. + * {%jdoc !!velocity::lang.vm.ast.VmNode %} - method `jjtAccept()` has been removed. Use {%jdoc core::lang.ast.Node#acceptVisitor(core::lang.ast.AstVisitor,P) %} instead. * `net.sourceforge.pmd.lang.vm.ast.VmParserVisitor` - Use {%jdoc vm::lang.vm.ast.VmVisitor %} or {%jdoc vm::lang.vm.ast.VmVisitorBase %} instead. + Use {%jdoc velocity::lang.vm.ast.VmVisitor %} or {%jdoc velocity::lang.vm.ast.VmVisitorBase %} instead. * `net.sourceforge.pmd.lang.vm.ast.VmParserVisitorAdapter` **Removed classes, interfaces and methods (not previously deprecated)** diff --git a/docs/pages/release_notes_pmd7.md b/docs/pages/release_notes_pmd7.md index 444cdd1232..a0ddd27183 100644 --- a/docs/pages/release_notes_pmd7.md +++ b/docs/pages/release_notes_pmd7.md @@ -1705,7 +1705,7 @@ These deprecations have already been rolled out in a previous version for the following languages: * Java: {% jdoc_package java::lang.java.ast %} * Java Server Pages: {% jdoc_package jsp::lang.jsp.ast %} -* Velocity Template Language: {% jdoc_package vm::lang.vm.ast %} +* Velocity Template Language: {% jdoc_package velocity::lang.vm.ast %} Outside of these packages, these changes also concern the following TokenManager implementations, and their corresponding Parser if it exists (in the same package): @@ -1720,7 +1720,7 @@ implementations, and their corresponding Parser if it exists (in the same packag * {% jdoc plsql::lang.plsql.PLSQLTokenManager %} * {% jdoc python::lang.python.PythonTokenManager %} * {% jdoc visualforce::lang.vf.VfTokenManager %} -* {% jdoc vm::lang.vm.VmTokenManager %} +* {% jdoc velocity::lang.vm.VmTokenManager %} In the **Java AST** the following attributes are deprecated and will issue a warning when used in XPath rules: @@ -1855,19 +1855,19 @@ The following usages are now deprecated **in the VM AST** (with other languages Those constructors will be made package private with 7.0.0. * **Subclassing of abstract node classes, or usage of their type**. The base classes are internal API and will be hidden in version 7.0.0. You should not couple your code to them. - * In the meantime you should use interfaces like {% jdoc vm::lang.vm.ast.VmNode %} or + * In the meantime you should use interfaces like {% jdoc velocity::lang.vm.ast.VmNode %} or {% jdoc core::lang.ast.Node %}, or the other published interfaces in this package, to refer to nodes generically. * Concrete node classes will **be made final** with 7.0.0. * Setters found in any node class or interface. **Rules should consider the AST immutable**. We will make those setters package private with 7.0.0. -* The package {% jdoc_package vm::lang.vm.directive %} as well as the classes - {% jdoc vm::lang.vm.util.DirectiveMapper %} and {% jdoc vm::lang.vm.util.LogUtil %} are deprecated +* The package {% jdoc_package velocity::lang.vm.directive %} as well as the classes + {% jdoc velocity::lang.vm.util.DirectiveMapper %} and {% jdoc velocity::lang.vm.util.LogUtil %} are deprecated for removal. They were only used internally during parsing. -* The class {% jdoc vm::lang.vm.VmParser %} is deprecated and should not be used directly. +* The class {% jdoc velocity::lang.vm.VmParser %} is deprecated and should not be used directly. Use {% jdoc !!core::lang.LanguageVersionHandler#getParser(ParserOptions) %} instead. -Please look at {% jdoc_package vm::lang.vm.ast %} to find out the full list of deprecations. +Please look at {% jdoc_package velocity::lang.vm.ast %} to find out the full list of deprecations. **PLSQL AST** @@ -2077,7 +2077,7 @@ of deprecations. * {% jdoc !q!jsp::lang.jsp.ast.DumpFacade %} * {% jdoc !q!plsql::lang.plsql.ast.DumpFacade %} * {% jdoc !q!visualforce::lang.vf.ast.DumpFacade %} - * {% jdoc !q!vm::lang.vm.ast.AbstractVmNode#dump(String, boolean, Writer) %} + * {% jdoc !q!velocity::lang.vm.ast.AbstractVmNode#dump(String, boolean, Writer) %} * {% jdoc !q!xml::lang.xml.ast.DumpFacade %} * The method {% jdoc !c!core::lang.LanguageVersionHandler#getDumpFacade(Writer, String, boolean) %} will be removed as well. It is deprecated, along with all its implementations in the subclasses of {% jdoc core::lang.LanguageVersionHandler %}. diff --git a/pmd-dist/src/test/java/net/sourceforge/pmd/dist/AllRulesIT.java b/pmd-dist/src/test/java/net/sourceforge/pmd/dist/AllRulesIT.java index 6e5b85b720..fbce76013c 100644 --- a/pmd-dist/src/test/java/net/sourceforge/pmd/dist/AllRulesIT.java +++ b/pmd-dist/src/test/java/net/sourceforge/pmd/dist/AllRulesIT.java @@ -18,7 +18,7 @@ class AllRulesIT extends AbstractBinaryDistributionTest { static Iterable languagesToTest() { // note: scala and wsdl have no rules return Arrays.asList("java", "apex", "html", "javascript", "jsp", "modelica", - "plsql", "pom", "visualforce", "velocitytemplate", "xml", "xsl"); + "plsql", "pom", "visualforce", "velocity", "xml", "xsl"); } @ParameterizedTest diff --git a/pmd-dist/src/test/java/net/sourceforge/pmd/dist/BinaryDistributionIT.java b/pmd-dist/src/test/java/net/sourceforge/pmd/dist/BinaryDistributionIT.java index d3119b7823..8e2f82a2cf 100644 --- a/pmd-dist/src/test/java/net/sourceforge/pmd/dist/BinaryDistributionIT.java +++ b/pmd-dist/src/test/java/net/sourceforge/pmd/dist/BinaryDistributionIT.java @@ -34,7 +34,7 @@ class BinaryDistributionIT extends AbstractBinaryDistributionTest { "julia", "kotlin", "lua", "matlab", "modelica", "objectivec", "perl", "php", "plsql", "pom", "python", "ruby", "scala", "swift", - "tsql", "typescript", "visualforce", "vm", "wsdl", "xml", "xsl" + "tsql", "typescript", "velocity", "visualforce", "wsdl", "xml", "xsl" ); private static final List SUPPORTED_LANGUAGES_PMD = listOf( @@ -61,11 +61,12 @@ class BinaryDistributionIT extends AbstractBinaryDistributionTest { "swift-4.2", "swift-5.0", "swift-5.1", "swift-5.2", "swift-5.3", "swift-5.4", "swift-5.5", "swift-5.6", "swift-5.7", "swift-5.8", "swift-5.9", + "velocity-2.0", "velocity-2.1", "velocity-2.2", "velocity-2.3", "visualforce-52", "visualforce-53", "visualforce-54", "visualforce-55", "visualforce-56", "visualforce-57", "visualforce-58", "visualforce-59", - "vm-2.0", "vm-2.1", "vm-2.2", "vm-2.3", "wsdl-1.1", - "wsdl-2.0", "xml-1.0", "xml-1.1", "xsl-1.0", "xsl-2.0", - "xsl-3.0" + "wsdl-1.1", "wsdl-2.0", + "xml-1.0", "xml-1.1", + "xsl-1.0", "xsl-2.0", "xsl-3.0" ); private final String srcDir = new File(".", "src/test/resources/sample-source/java/").getAbsolutePath(); diff --git a/pmd-dist/src/test/resources/rulesets/all-velocity.xml b/pmd-dist/src/test/resources/rulesets/all-velocity.xml new file mode 100644 index 0000000000..0c8e9a5ff1 --- /dev/null +++ b/pmd-dist/src/test/resources/rulesets/all-velocity.xml @@ -0,0 +1,18 @@ + + + + Every Velocity Template Language Rule in PMD + + + + + + + + + + + diff --git a/pmd-dist/src/test/resources/rulesets/all-velocitytemplate.xml b/pmd-dist/src/test/resources/rulesets/all-velocitytemplate.xml deleted file mode 100644 index 7918dde8b7..0000000000 --- a/pmd-dist/src/test/resources/rulesets/all-velocitytemplate.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - Every Velocity Template Language Rule in PMD - - - - - - - - - - - diff --git a/pmd-dist/src/test/resources/sample-source/velocitytemplate/helloworld.vm b/pmd-dist/src/test/resources/sample-source/velocity/helloworld.vm similarity index 100% rename from pmd-dist/src/test/resources/sample-source/velocitytemplate/helloworld.vm rename to pmd-dist/src/test/resources/sample-source/velocity/helloworld.vm diff --git a/pmd-languages-deps/pom.xml b/pmd-languages-deps/pom.xml index 617cace44a..6a6df7118b 100644 --- a/pmd-languages-deps/pom.xml +++ b/pmd-languages-deps/pom.xml @@ -154,7 +154,7 @@ net.sourceforge.pmd - pmd-vm + pmd-velocity ${project.version} diff --git a/pmd-vm/.gitignore b/pmd-velocity/.gitignore similarity index 100% rename from pmd-vm/.gitignore rename to pmd-velocity/.gitignore diff --git a/pmd-vm/etc/grammar/Vm.jjt b/pmd-velocity/etc/grammar/Vtl.jjt similarity index 99% rename from pmd-vm/etc/grammar/Vm.jjt rename to pmd-velocity/etc/grammar/Vtl.jjt index aee65bcc95..74804d4dd0 100644 --- a/pmd-vm/etc/grammar/Vm.jjt +++ b/pmd-velocity/etc/grammar/Vtl.jjt @@ -33,8 +33,8 @@ options } -PARSER_BEGIN(VmParserImpl) -package net.sourceforge.pmd.lang.vm.ast; +PARSER_BEGIN(VtlParserImpl) +package net.sourceforge.pmd.lang.velocity.ast; import java.io.IOException; import java.util.ArrayList; @@ -59,7 +59,7 @@ import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; * @author Henning P. Schmiedehausen * @version $Id$ */ -public class VmParserImpl +public class VtlParserImpl { private void throwParseException(String message) { throw new ParseException(message).withLocation(token); @@ -109,7 +109,7 @@ public class VmParserImpl } } -PARSER_END(VmParserImpl) +PARSER_END(VtlParserImpl) TOKEN_MGR_DECLS: { @@ -1101,7 +1101,7 @@ void DirectiveArg() #void : {} * Supports the Pluggable Directives * #foo( arg+ ) */ -VmNode Directive() : +VtlNode Directive() : { JavaccToken t = null; int argPos = 0; @@ -1117,7 +1117,7 @@ VmNode Directive() : ((t = ) | (t = )) { String directiveName; - if (t.kind == VmTokenKinds.BRACKETED_WORD) + if (t.kind == VtlTokenKinds.BRACKETED_WORD) { directiveName = t.getImage().substring(2, t.getImage().length() - 1); } diff --git a/pmd-vm/pmd-vm-checkstyle-suppressions.xml b/pmd-velocity/pmd-velocity-checkstyle-suppressions.xml similarity index 100% rename from pmd-vm/pmd-vm-checkstyle-suppressions.xml rename to pmd-velocity/pmd-velocity-checkstyle-suppressions.xml diff --git a/pmd-vm/pom.xml b/pmd-velocity/pom.xml similarity index 94% rename from pmd-vm/pom.xml rename to pmd-velocity/pom.xml index 493832e65d..fbc05bd757 100644 --- a/pmd-vm/pom.xml +++ b/pmd-velocity/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - pmd-vm - PMD Velocity + pmd-velocity + PMD Velocity Template Language (VTL) net.sourceforge.pmd @@ -44,8 +44,8 @@ - - + + @@ -75,7 +75,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - pmd-vm-checkstyle-suppressions.xml + pmd-velocity-checkstyle-suppressions.xml diff --git a/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/VtlHandler.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/VtlHandler.java new file mode 100644 index 0000000000..3dd78109c9 --- /dev/null +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/VtlHandler.java @@ -0,0 +1,18 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.velocity; + +import net.sourceforge.pmd.lang.AbstractPmdLanguageVersionHandler; +import net.sourceforge.pmd.lang.ast.Parser; +import net.sourceforge.pmd.lang.velocity.ast.VtlParser; + +public class VtlHandler extends AbstractPmdLanguageVersionHandler { + + @Override + public Parser getParser() { + return new VtlParser(); + } + +} diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmLanguageModule.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/VtlLanguageModule.java similarity index 65% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmLanguageModule.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/VtlLanguageModule.java index 7f1ddd8544..81f06392df 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmLanguageModule.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/VtlLanguageModule.java @@ -2,37 +2,37 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm; +package net.sourceforge.pmd.lang.velocity; import net.sourceforge.pmd.cpd.CpdLexer; import net.sourceforge.pmd.lang.LanguagePropertyBundle; import net.sourceforge.pmd.lang.LanguageRegistry; import net.sourceforge.pmd.lang.impl.SimpleLanguageModuleBase; -import net.sourceforge.pmd.lang.vm.cpd.VmCpdLexer; +import net.sourceforge.pmd.lang.velocity.cpd.VtlCpdLexer; /** * Created by christoferdutz on 20.09.14. */ -public class VmLanguageModule extends SimpleLanguageModuleBase { - static final String ID = "vm"; +public class VtlLanguageModule extends SimpleLanguageModuleBase { + static final String ID = "velocity"; static final String NAME = "Velocity Template Language (VTL)"; - public VmLanguageModule() { + public VtlLanguageModule() { super(LanguageMetadata.withId(ID).name(NAME) .extensions("vm") .addVersion("2.0") .addVersion("2.1") .addVersion("2.2") .addDefaultVersion("2.3"), - new VmHandler()); + new VtlHandler()); } - public static VmLanguageModule getInstance() { - return (VmLanguageModule) LanguageRegistry.PMD.getLanguageById(ID); + public static VtlLanguageModule getInstance() { + return (VtlLanguageModule) LanguageRegistry.PMD.getLanguageById(ID); } @Override public CpdLexer createCpdLexer(LanguagePropertyBundle bundle) { - return new VmCpdLexer(); + return new VtlCpdLexer(); } } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTAddNode.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTAddNode.java similarity index 91% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTAddNode.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTAddNode.java index 95b1e6d156..ce9bee041a 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTAddNode.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTAddNode.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -39,7 +39,7 @@ public final class ASTAddNode extends ASTMathNode { @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTBlock.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTBlock.java similarity index 70% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTBlock.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTBlock.java index 0294f55153..5279d6671c 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTBlock.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTBlock.java @@ -2,11 +2,11 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; import org.apache.commons.lang3.StringUtils; -public final class ASTBlock extends AbstractVmNode { +public final class ASTBlock extends AbstractVtlNode { ASTBlock(int id) { super(id); @@ -14,7 +14,7 @@ public final class ASTBlock extends AbstractVmNode { @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDirective.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTDirective.java similarity index 94% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDirective.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTDirective.java index eedab86303..bb1ca820b3 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDirective.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTDirective.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; import java.util.Collections; import java.util.HashSet; @@ -37,7 +37,7 @@ import java.util.Set; * @author Kasper Nielsen * @version $Id: ASTDirective.java 724825 2008-12-09 18:56:06Z nbubna $ */ -public final class ASTDirective extends AbstractVmNode { +public final class ASTDirective extends AbstractVtlNode { private static final Set DIRECTIVE_NAMES; private static final Set BLOCK_DIRECTIVES; @@ -73,7 +73,7 @@ public final class ASTDirective extends AbstractVmNode { } @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDivNode.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTDivNode.java similarity index 91% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDivNode.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTDivNode.java index c0bc618f79..f6a1b0d4f1 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDivNode.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTDivNode.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -40,7 +40,7 @@ public final class ASTDivNode extends ASTMathNode { @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTEscape.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTEscape.java similarity index 87% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTEscape.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTEscape.java index 37101a3690..bf141b1eaf 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTEscape.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTEscape.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -29,7 +29,7 @@ package net.sourceforge.pmd.lang.vm.ast; * @author Geir Magnusson Jr. * @version $Id: ASTEscape.java 517553 2007-03-13 06:09:58Z wglass $ */ -public final class ASTEscape extends AbstractVmNode { +public final class ASTEscape extends AbstractVtlNode { /** Used by the parser. */ private String val; @@ -48,7 +48,7 @@ public final class ASTEscape extends AbstractVmNode { } @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMathNode.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTMathNode.java similarity index 93% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMathNode.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTMathNode.java index d8a29b52f7..f219a397c5 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMathNode.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTMathNode.java @@ -1,4 +1,4 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -32,7 +32,7 @@ package net.sourceforge.pmd.lang.vm.ast; * @author Nathan Bubna * @version $Id: ASTMathNode.java 517553 2007-03-13 06:09:58Z wglass $ */ -abstract class ASTMathNode extends AbstractVmNode { +abstract class ASTMathNode extends AbstractVtlNode { ASTMathNode(int id) { super(id); diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMethod.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTMethod.java similarity index 88% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMethod.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTMethod.java index 217081e8ac..13d7935c55 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMethod.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTMethod.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -35,14 +35,14 @@ package net.sourceforge.pmd.lang.vm.ast; * @author Geir Magnusson Jr. * @version $Id: ASTMethod.java 720228 2008-11-24 16:58:33Z nbubna $ */ -public final class ASTMethod extends AbstractVmNode { +public final class ASTMethod extends AbstractVtlNode { ASTMethod(int id) { super(id); } @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTModNode.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTModNode.java similarity index 90% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTModNode.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTModNode.java index 24cb9b0555..af8ac7c625 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTModNode.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTModNode.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -39,7 +39,7 @@ public final class ASTModNode extends ASTMathNode { @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMulNode.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTMulNode.java similarity index 91% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMulNode.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTMulNode.java index 780950c3f5..f36f6fc534 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMulNode.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTMulNode.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -40,7 +40,7 @@ public final class ASTMulNode extends ASTMathNode { @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTReference.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTReference.java similarity index 93% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTReference.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTReference.java index 5d208ad78d..5d0dbad3fd 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTReference.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTReference.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -32,7 +32,7 @@ package net.sourceforge.pmd.lang.vm.ast; * @author Kent Johnson * @version $Id: ASTReference.java 806597 2009-08-21 15:21:44Z nbubna $ */ -public final class ASTReference extends AbstractVmNode { +public final class ASTReference extends AbstractVtlNode { private String rootString; private String literal = null; @@ -42,7 +42,7 @@ public final class ASTReference extends AbstractVmNode { } @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTStringLiteral.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTStringLiteral.java similarity index 87% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTStringLiteral.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTStringLiteral.java index 51daa8bab7..8f6ac41fb0 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTStringLiteral.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTStringLiteral.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -25,14 +25,14 @@ package net.sourceforge.pmd.lang.vm.ast; * @author Jason van Zyl * @version $Id: ASTStringLiteral.java 705297 2008-10-16 17:59:24Z nbubna $ */ -public final class ASTStringLiteral extends AbstractVmNode { +public final class ASTStringLiteral extends AbstractVtlNode { ASTStringLiteral(int id) { super(id); } @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTSubtractNode.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTSubtractNode.java similarity index 91% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTSubtractNode.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTSubtractNode.java index bfa9791e1b..d9490bd2c2 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTSubtractNode.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTSubtractNode.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -41,7 +41,7 @@ public final class ASTSubtractNode extends ASTMathNode { @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTTemplate.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTTemplate.java similarity index 74% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTTemplate.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTTemplate.java index d2a544b3dd..283bc7c01c 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTTemplate.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/ASTTemplate.java @@ -2,13 +2,13 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; import net.sourceforge.pmd.lang.ast.AstInfo; import net.sourceforge.pmd.lang.ast.Parser.ParserTask; import net.sourceforge.pmd.lang.ast.RootNode; -public final class ASTTemplate extends AbstractVmNode implements RootNode { +public final class ASTTemplate extends AbstractVtlNode implements RootNode { private AstInfo astInfo; @@ -28,7 +28,7 @@ public final class ASTTemplate extends AbstractVmNode implements RootNode { @Override - protected R acceptVmVisitor(VmVisitor visitor, P data) { + protected R acceptVtlVisitor(VtlVisitor visitor, P data) { return visitor.visit(this, data); } } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/AbstractVmNode.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/AbstractVtlNode.java similarity index 79% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/AbstractVmNode.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/AbstractVtlNode.java index 82e4c70be6..b2221fa6fc 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/AbstractVmNode.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/AbstractVtlNode.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -24,26 +24,26 @@ import net.sourceforge.pmd.lang.ast.AstVisitor; import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode; import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; -abstract class AbstractVmNode extends AbstractJjtreeNode implements VmNode { +abstract class AbstractVtlNode extends AbstractJjtreeNode implements VtlNode { - protected AbstractVmNode(final int i) { + protected AbstractVtlNode(final int i) { super(i); } @Override public String getXPathNodeName() { - return VmParserImplTreeConstants.jjtNodeName[id]; + return VtlParserImplTreeConstants.jjtNodeName[id]; } - protected abstract R acceptVmVisitor(VmVisitor visitor, P data); + protected abstract R acceptVtlVisitor(VtlVisitor visitor, P data); @Override @SuppressWarnings("unchecked") public final R acceptVisitor(AstVisitor visitor, P data) { - if (visitor instanceof VmVisitor) { - return acceptVmVisitor((VmVisitor) visitor, data); + if (visitor instanceof VtlVisitor) { + return acceptVtlVisitor((VtlVisitor) visitor, data); } return visitor.cannotVisit(this, data); } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/NodeUtils.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/NodeUtils.java similarity index 97% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/NodeUtils.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/NodeUtils.java index 913f7d23d5..3ea6ea0205 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/NodeUtils.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/NodeUtils.java @@ -1,5 +1,5 @@ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; @@ -117,7 +117,7 @@ final class NodeUtils { */ static String tokenLiteral(final JavaccToken t) { // Look at kind of token and return "" when it's a multiline comment - if (t.kind == VmTokenKinds.MULTI_LINE_COMMENT) { + if (t.kind == VtlTokenKinds.MULTI_LINE_COMMENT) { return ""; } else if (t.getPreviousComment() == null || t.getPreviousComment().getImage().startsWith("##")) { return t.getImage(); diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmNode.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/VtlNode.java similarity index 59% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmNode.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/VtlNode.java index 8d93fc91df..2e0ea70907 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmNode.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/VtlNode.java @@ -2,9 +2,9 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; import net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeNode; -public interface VmNode extends JjtreeNode { +public interface VtlNode extends JjtreeNode { } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmParser.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/VtlParser.java similarity index 81% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmParser.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/VtlParser.java index 2c7491b21e..8a4227da00 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmParser.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/VtlParser.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.ast; +package net.sourceforge.pmd.lang.velocity.ast; import org.checkerframework.checker.nullness.qual.Nullable; @@ -14,16 +14,16 @@ import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccTokenDocument.TokenDocumen import net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeParserAdapter; /** - * Adapter for the VmParser. + * Adapter for the VtlParser. */ -public class VmParser extends JjtreeParserAdapter { +public class VtlParser extends JjtreeParserAdapter { - private static final TokenDocumentBehavior TOKEN_BEHAVIOR = new TokenDocumentBehavior(VmTokenKinds.TOKEN_NAMES) { + private static final TokenDocumentBehavior TOKEN_BEHAVIOR = new TokenDocumentBehavior(VtlTokenKinds.TOKEN_NAMES) { @Override public JavaccToken createToken(JavaccTokenDocument self, int kind, CharStream cs, @Nullable String image) { String realImage = image == null ? cs.getTokenImage() : image; - if (kind == VmTokenKinds.ESCAPE_DIRECTIVE) { + if (kind == VtlTokenKinds.ESCAPE_DIRECTIVE) { realImage = escapedDirective(realImage); } @@ -44,7 +44,7 @@ public class VmParser extends JjtreeParserAdapter { @Override protected ASTTemplate parseImpl(CharStream cs, ParserTask task) throws ParseException { - return new VmParserImpl(cs).Template().makeTaskInfo(task); + return new VtlParserImpl(cs).Template().makeTaskInfo(task); } diff --git a/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/VtlVisitorBase.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/VtlVisitorBase.java new file mode 100644 index 0000000000..ac9987b1aa --- /dev/null +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/ast/VtlVisitorBase.java @@ -0,0 +1,12 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.velocity.ast; + + +import net.sourceforge.pmd.lang.ast.AstVisitorBase; + +public abstract class VtlVisitorBase extends AstVisitorBase implements VtlVisitor { + +} diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/cpd/VmCpdLexer.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/cpd/VtlCpdLexer.java similarity index 71% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/cpd/VmCpdLexer.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/cpd/VtlCpdLexer.java index 9a2b0a78ba..4d7ad4fa95 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/cpd/VmCpdLexer.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/cpd/VtlCpdLexer.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.cpd; +package net.sourceforge.pmd.lang.velocity.cpd; import java.io.IOException; @@ -11,14 +11,14 @@ import net.sourceforge.pmd.lang.TokenManager; import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream; import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; import net.sourceforge.pmd.lang.document.TextDocument; -import net.sourceforge.pmd.lang.vm.ast.VmTokenKinds; +import net.sourceforge.pmd.lang.velocity.ast.VtlTokenKinds; /** *

Note: This class has been called VmTokenizer in PMD 6

. */ -public class VmCpdLexer extends JavaccCpdLexer { +public class VtlCpdLexer extends JavaccCpdLexer { @Override protected TokenManager makeLexerImpl(TextDocument doc) throws IOException { - return VmTokenKinds.newTokenManager(CharStream.create(doc)); + return VtlTokenKinds.newTokenManager(CharStream.create(doc)); } } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/AbstractVmRule.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/AbstractVtlRule.java similarity index 71% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/AbstractVmRule.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/AbstractVtlRule.java index 704cb31534..c89007c5f5 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/AbstractVmRule.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/AbstractVtlRule.java @@ -2,14 +2,14 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule; +package net.sourceforge.pmd.lang.velocity.rule; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.rule.AbstractRule; -import net.sourceforge.pmd.lang.vm.ast.VmVisitor; +import net.sourceforge.pmd.lang.velocity.ast.VtlVisitor; import net.sourceforge.pmd.reporting.RuleContext; -public abstract class AbstractVmRule extends AbstractRule implements VmVisitor { +public abstract class AbstractVtlRule extends AbstractRule implements VtlVisitor { @Override public void apply(Node target, RuleContext ctx) { diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/AvoidReassigningParametersRule.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/AvoidReassigningParametersRule.java similarity index 71% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/AvoidReassigningParametersRule.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/AvoidReassigningParametersRule.java index 1b6a716db7..633871807b 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/AvoidReassigningParametersRule.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/AvoidReassigningParametersRule.java @@ -2,17 +2,17 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.bestpractices; +package net.sourceforge.pmd.lang.velocity.rule.bestpractices; import java.util.HashSet; import java.util.Set; -import net.sourceforge.pmd.lang.vm.ast.ASTDirective; -import net.sourceforge.pmd.lang.vm.ast.ASTReference; -import net.sourceforge.pmd.lang.vm.ast.ASTSetDirective; -import net.sourceforge.pmd.lang.vm.rule.AbstractVmRule; +import net.sourceforge.pmd.lang.velocity.ast.ASTDirective; +import net.sourceforge.pmd.lang.velocity.ast.ASTReference; +import net.sourceforge.pmd.lang.velocity.ast.ASTSetDirective; +import net.sourceforge.pmd.lang.velocity.rule.AbstractVtlRule; -public class AvoidReassigningParametersRule extends AbstractVmRule { +public class AvoidReassigningParametersRule extends AbstractVtlRule { @Override public Object visit(final ASTDirective node, final Object data) { diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/UnusedMacroParameterRule.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/UnusedMacroParameterRule.java similarity index 83% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/UnusedMacroParameterRule.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/UnusedMacroParameterRule.java index 6e6cf6d5df..520c7e72d5 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/UnusedMacroParameterRule.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/UnusedMacroParameterRule.java @@ -2,18 +2,18 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.bestpractices; +package net.sourceforge.pmd.lang.velocity.rule.bestpractices; import java.util.HashSet; import java.util.Set; -import net.sourceforge.pmd.lang.vm.ast.ASTBlock; -import net.sourceforge.pmd.lang.vm.ast.ASTDirective; -import net.sourceforge.pmd.lang.vm.ast.ASTReference; -import net.sourceforge.pmd.lang.vm.ast.ASTStringLiteral; -import net.sourceforge.pmd.lang.vm.rule.AbstractVmRule; +import net.sourceforge.pmd.lang.velocity.ast.ASTBlock; +import net.sourceforge.pmd.lang.velocity.ast.ASTDirective; +import net.sourceforge.pmd.lang.velocity.ast.ASTReference; +import net.sourceforge.pmd.lang.velocity.ast.ASTStringLiteral; +import net.sourceforge.pmd.lang.velocity.rule.AbstractVtlRule; -public class UnusedMacroParameterRule extends AbstractVmRule { +public class UnusedMacroParameterRule extends AbstractVtlRule { @Override public Object visit(final ASTDirective node, final Object data) { diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/AvoidDeeplyNestedIfStmtsRule.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/AvoidDeeplyNestedIfStmtsRule.java similarity index 71% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/AvoidDeeplyNestedIfStmtsRule.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/AvoidDeeplyNestedIfStmtsRule.java index a5053b0918..ec1b0323e9 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/AvoidDeeplyNestedIfStmtsRule.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/AvoidDeeplyNestedIfStmtsRule.java @@ -2,20 +2,20 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.design; +package net.sourceforge.pmd.lang.velocity.rule.design; import static net.sourceforge.pmd.properties.NumericConstraints.positive; -import net.sourceforge.pmd.lang.vm.ast.ASTElseIfStatement; -import net.sourceforge.pmd.lang.vm.ast.ASTIfStatement; -import net.sourceforge.pmd.lang.vm.ast.ASTTemplate; -import net.sourceforge.pmd.lang.vm.ast.VmNode; -import net.sourceforge.pmd.lang.vm.rule.AbstractVmRule; +import net.sourceforge.pmd.lang.velocity.ast.ASTElseIfStatement; +import net.sourceforge.pmd.lang.velocity.ast.ASTIfStatement; +import net.sourceforge.pmd.lang.velocity.ast.ASTTemplate; +import net.sourceforge.pmd.lang.velocity.ast.VtlNode; +import net.sourceforge.pmd.lang.velocity.rule.AbstractVtlRule; import net.sourceforge.pmd.properties.PropertyDescriptor; import net.sourceforge.pmd.properties.PropertyFactory; -public class AvoidDeeplyNestedIfStmtsRule extends AbstractVmRule { +public class AvoidDeeplyNestedIfStmtsRule extends AbstractVtlRule { private int depth; private int depthLimit; @@ -46,9 +46,9 @@ public class AvoidDeeplyNestedIfStmtsRule extends AbstractVmRule { return handleIf(node, data); } - private Object handleIf(VmNode node, Object data) { + private Object handleIf(VtlNode node, Object data) { depth++; - super.visitVmNode(node, data); + super.visitVtlNode(node, data); if (depth == depthLimit) { asCtx(data).addViolation(node); } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/CollapsibleIfStatementsRule.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/CollapsibleIfStatementsRule.java similarity index 80% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/CollapsibleIfStatementsRule.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/CollapsibleIfStatementsRule.java index e94804e2a7..3963b9b40c 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/CollapsibleIfStatementsRule.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/CollapsibleIfStatementsRule.java @@ -2,20 +2,20 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.design; +package net.sourceforge.pmd.lang.velocity.rule.design; import org.apache.commons.lang3.StringUtils; import net.sourceforge.pmd.lang.ast.Node; -import net.sourceforge.pmd.lang.vm.ast.ASTBlock; -import net.sourceforge.pmd.lang.vm.ast.ASTElseIfStatement; -import net.sourceforge.pmd.lang.vm.ast.ASTElseStatement; -import net.sourceforge.pmd.lang.vm.ast.ASTIfStatement; -import net.sourceforge.pmd.lang.vm.ast.ASTText; -import net.sourceforge.pmd.lang.vm.ast.VmNode; -import net.sourceforge.pmd.lang.vm.rule.AbstractVmRule; +import net.sourceforge.pmd.lang.velocity.ast.ASTBlock; +import net.sourceforge.pmd.lang.velocity.ast.ASTElseIfStatement; +import net.sourceforge.pmd.lang.velocity.ast.ASTElseStatement; +import net.sourceforge.pmd.lang.velocity.ast.ASTIfStatement; +import net.sourceforge.pmd.lang.velocity.ast.ASTText; +import net.sourceforge.pmd.lang.velocity.ast.VtlNode; +import net.sourceforge.pmd.lang.velocity.rule.AbstractVtlRule; -public class CollapsibleIfStatementsRule extends AbstractVmRule { +public class CollapsibleIfStatementsRule extends AbstractVtlRule { @Override public Object visit(final ASTIfStatement node, final Object data) { @@ -32,7 +32,7 @@ public class CollapsibleIfStatementsRule extends AbstractVmRule { return super.visit(node, data); } - private void handleIfElseIf(final VmNode node, final Object data) { + private void handleIfElseIf(final VtlNode node, final Object data) { if (node.firstChild(ASTElseStatement.class) == null && node.firstChild(ASTElseIfStatement.class) == null) { final ASTBlock ifBlock = node.firstChild(ASTBlock.class); diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/ExcessiveTemplateLengthRule.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/ExcessiveTemplateLengthRule.java similarity index 83% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/ExcessiveTemplateLengthRule.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/ExcessiveTemplateLengthRule.java index 99e933d807..f25220f700 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/ExcessiveTemplateLengthRule.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/ExcessiveTemplateLengthRule.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.design; +package net.sourceforge.pmd.lang.velocity.rule.design; import static net.sourceforge.pmd.properties.NumericConstraints.positive; @@ -10,11 +10,11 @@ import org.checkerframework.checker.nullness.qual.NonNull; import net.sourceforge.pmd.lang.rule.RuleTargetSelector; import net.sourceforge.pmd.lang.rule.internal.CommonPropertyDescriptors; -import net.sourceforge.pmd.lang.vm.ast.ASTTemplate; -import net.sourceforge.pmd.lang.vm.rule.AbstractVmRule; +import net.sourceforge.pmd.lang.velocity.ast.ASTTemplate; +import net.sourceforge.pmd.lang.velocity.rule.AbstractVtlRule; import net.sourceforge.pmd.properties.PropertyDescriptor; -public class ExcessiveTemplateLengthRule extends AbstractVmRule { +public class ExcessiveTemplateLengthRule extends AbstractVtlRule { private static final PropertyDescriptor REPORT_LEVEL = CommonPropertyDescriptors.reportLevelProperty() diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/NoInlineJavaScriptRule.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/NoInlineJavaScriptRule.java similarity index 77% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/NoInlineJavaScriptRule.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/NoInlineJavaScriptRule.java index c4ecbc78bd..af4956e079 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/design/NoInlineJavaScriptRule.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/design/NoInlineJavaScriptRule.java @@ -2,15 +2,15 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.design; +package net.sourceforge.pmd.lang.velocity.rule.design; import java.util.regex.Matcher; import java.util.regex.Pattern; -import net.sourceforge.pmd.lang.vm.ast.ASTText; -import net.sourceforge.pmd.lang.vm.rule.AbstractVmRule; +import net.sourceforge.pmd.lang.velocity.ast.ASTText; +import net.sourceforge.pmd.lang.velocity.rule.AbstractVtlRule; -public class NoInlineJavaScriptRule extends AbstractVmRule { +public class NoInlineJavaScriptRule extends AbstractVtlRule { private static final Pattern SCRIPT_PATTERN = Pattern.compile("]*>", Pattern.CASE_INSENSITIVE); private static final Pattern SRC_PATTERN = Pattern.compile("\\ssrc\\s*=", Pattern.CASE_INSENSITIVE); diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyForeachStmtRule.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyForeachStmtRule.java similarity index 53% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyForeachStmtRule.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyForeachStmtRule.java index b08d9d3b18..52c24b3ef6 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyForeachStmtRule.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyForeachStmtRule.java @@ -2,13 +2,13 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.errorprone; +package net.sourceforge.pmd.lang.velocity.rule.errorprone; -import net.sourceforge.pmd.lang.vm.ast.ASTBlock; -import net.sourceforge.pmd.lang.vm.ast.ASTForeachStatement; -import net.sourceforge.pmd.lang.vm.rule.AbstractVmRule; +import net.sourceforge.pmd.lang.velocity.ast.ASTBlock; +import net.sourceforge.pmd.lang.velocity.ast.ASTForeachStatement; +import net.sourceforge.pmd.lang.velocity.rule.AbstractVtlRule; -public class EmptyForeachStmtRule extends AbstractVmRule { +public class EmptyForeachStmtRule extends AbstractVtlRule { @Override public Object visit(final ASTForeachStatement node, final Object data) { diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyIfStmtRule.java b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyIfStmtRule.java similarity index 56% rename from pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyIfStmtRule.java rename to pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyIfStmtRule.java index 8b314b3590..54860d4ff7 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyIfStmtRule.java +++ b/pmd-velocity/src/main/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyIfStmtRule.java @@ -2,16 +2,16 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.errorprone; +package net.sourceforge.pmd.lang.velocity.rule.errorprone; -import net.sourceforge.pmd.lang.vm.ast.ASTBlock; -import net.sourceforge.pmd.lang.vm.ast.ASTElseIfStatement; -import net.sourceforge.pmd.lang.vm.ast.ASTElseStatement; -import net.sourceforge.pmd.lang.vm.ast.ASTIfStatement; -import net.sourceforge.pmd.lang.vm.ast.VmNode; -import net.sourceforge.pmd.lang.vm.rule.AbstractVmRule; +import net.sourceforge.pmd.lang.velocity.ast.ASTBlock; +import net.sourceforge.pmd.lang.velocity.ast.ASTElseIfStatement; +import net.sourceforge.pmd.lang.velocity.ast.ASTElseStatement; +import net.sourceforge.pmd.lang.velocity.ast.ASTIfStatement; +import net.sourceforge.pmd.lang.velocity.ast.VtlNode; +import net.sourceforge.pmd.lang.velocity.rule.AbstractVtlRule; -public class EmptyIfStmtRule extends AbstractVmRule { +public class EmptyIfStmtRule extends AbstractVtlRule { @Override public Object visit(final ASTIfStatement node, final Object data) { handleIf(node, data); @@ -30,7 +30,7 @@ public class EmptyIfStmtRule extends AbstractVmRule { return super.visit(node, data); } - private void handleIf(final VmNode node, final Object data) { + private void handleIf(final VtlNode node, final Object data) { if (node.firstChild(ASTBlock.class).isEmpty()) { asCtx(data).addViolation(node); } diff --git a/pmd-velocity/src/main/resources/META-INF/services/net.sourceforge.pmd.lang.Language b/pmd-velocity/src/main/resources/META-INF/services/net.sourceforge.pmd.lang.Language new file mode 100644 index 0000000000..f791fb9a97 --- /dev/null +++ b/pmd-velocity/src/main/resources/META-INF/services/net.sourceforge.pmd.lang.Language @@ -0,0 +1 @@ +net.sourceforge.pmd.lang.velocity.VtlLanguageModule diff --git a/pmd-vm/src/main/resources/category/vm/bestpractices.xml b/pmd-velocity/src/main/resources/category/velocity/bestpractices.xml similarity index 67% rename from pmd-vm/src/main/resources/category/vm/bestpractices.xml rename to pmd-velocity/src/main/resources/category/velocity/bestpractices.xml index 327320f7f8..6d6f8de81e 100644 --- a/pmd-vm/src/main/resources/category/vm/bestpractices.xml +++ b/pmd-velocity/src/main/resources/category/velocity/bestpractices.xml @@ -10,11 +10,11 @@ Rules which enforce generally accepted best practices. + class="net.sourceforge.pmd.lang.velocity.rule.bestpractices.AvoidReassigningParametersRule" + externalInfoUrl="${pmd.website.baseurl}/pmd_rules_velocity_bestpractices.html#avoidreassigningparameters"> Reassigning values to incoming parameters is not recommended. Use temporary local variables instead. @@ -22,11 +22,11 @@ Reassigning values to incoming parameters is not recommended. Use temporary loc + class="net.sourceforge.pmd.lang.velocity.rule.bestpractices.UnusedMacroParameterRule" + externalInfoUrl="${pmd.website.baseurl}/pmd_rules_velocity_bestpractices.html#unusedmacroparameter"> Avoid unused macro parameters. They should be deleted. diff --git a/pmd-velocity/src/main/resources/category/velocity/categories.properties b/pmd-velocity/src/main/resources/category/velocity/categories.properties new file mode 100644 index 0000000000..a8a97bf71f --- /dev/null +++ b/pmd-velocity/src/main/resources/category/velocity/categories.properties @@ -0,0 +1,17 @@ +# +# BSD-style license; for more info see http://pmd.sourceforge.net/license.html +# + +rulesets.filenames=\ + category/velocity/bestpractices.xml,\ + category/velocity/design.xml,\ + category/velocity/errorprone.xml + +# +# categories without rules +# +# category/velocity/codestyle.xml +# category/velocity/documentation.xml +# category/velocity/multithreading.xml +# category/velocity/performance.xml +# category/velocity/security.xml diff --git a/pmd-vm/src/main/resources/category/vm/codestyle.xml b/pmd-velocity/src/main/resources/category/velocity/codestyle.xml similarity index 100% rename from pmd-vm/src/main/resources/category/vm/codestyle.xml rename to pmd-velocity/src/main/resources/category/velocity/codestyle.xml diff --git a/pmd-vm/src/main/resources/category/vm/design.xml b/pmd-velocity/src/main/resources/category/velocity/design.xml similarity index 66% rename from pmd-vm/src/main/resources/category/vm/design.xml rename to pmd-velocity/src/main/resources/category/velocity/design.xml index eaad2f1fe4..acc723aa4f 100644 --- a/pmd-vm/src/main/resources/category/vm/design.xml +++ b/pmd-velocity/src/main/resources/category/velocity/design.xml @@ -10,11 +10,11 @@ Rules that help you discover design issues. + class="net.sourceforge.pmd.lang.velocity.rule.design.AvoidDeeplyNestedIfStmtsRule" + externalInfoUrl="${pmd.website.baseurl}/pmd_rules_velocity_design.html#avoiddeeplynestedifstmts"> Avoid creating deeply nested if-then statements since they are harder to read and error-prone to maintain. @@ -22,11 +22,11 @@ Avoid creating deeply nested if-then statements since they are harder to read an + class="net.sourceforge.pmd.lang.velocity.rule.design.CollapsibleIfStatementsRule" + externalInfoUrl="${pmd.website.baseurl}/pmd_rules_velocity_design.html#collapsibleifstatements"> Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator. @@ -34,11 +34,11 @@ Sometimes two consecutive 'if' statements can be consolidated by separating thei + class="net.sourceforge.pmd.lang.velocity.rule.design.ExcessiveTemplateLengthRule" + externalInfoUrl="${pmd.website.baseurl}/pmd_rules_velocity_design.html#excessivetemplatelength"> The template is too long. It should be broken up into smaller pieces. @@ -46,11 +46,11 @@ The template is too long. It should be broken up into smaller pieces. + class="net.sourceforge.pmd.lang.velocity.rule.design.NoInlineJavaScriptRule" + externalInfoUrl="${pmd.website.baseurl}/pmd_rules_velocity_design.html#noinlinejavascript"> Avoid inline JavaScript. Import .js files instead. @@ -58,11 +58,11 @@ Avoid inline JavaScript. Import .js files instead. + externalInfoUrl="${pmd.website.baseurl}/pmd_rules_velocity_design.html#noinlinestyles"> Avoid inline styles. Use css classes instead. diff --git a/pmd-vm/src/main/resources/category/vm/documentation.xml b/pmd-velocity/src/main/resources/category/velocity/documentation.xml similarity index 100% rename from pmd-vm/src/main/resources/category/vm/documentation.xml rename to pmd-velocity/src/main/resources/category/velocity/documentation.xml diff --git a/pmd-vm/src/main/resources/category/vm/errorprone.xml b/pmd-velocity/src/main/resources/category/velocity/errorprone.xml similarity index 67% rename from pmd-vm/src/main/resources/category/vm/errorprone.xml rename to pmd-velocity/src/main/resources/category/velocity/errorprone.xml index bcc3ed19cd..c2b041f8b1 100644 --- a/pmd-vm/src/main/resources/category/vm/errorprone.xml +++ b/pmd-velocity/src/main/resources/category/velocity/errorprone.xml @@ -10,11 +10,11 @@ Rules to detect constructs that are either broken, extremely confusing or prone + class="net.sourceforge.pmd.lang.velocity.rule.errorprone.EmptyForeachStmtRule" + externalInfoUrl="${pmd.website.baseurl}/pmd_rules_velocity_errorprone.html#emptyforeachstmt"> Empty foreach statements should be deleted. @@ -22,11 +22,11 @@ Empty foreach statements should be deleted. + class="net.sourceforge.pmd.lang.velocity.rule.errorprone.EmptyIfStmtRule" + externalInfoUrl="${pmd.website.baseurl}/pmd_rules_velocity_errorprone.html#emptyifstmt"> Empty if statements should be deleted. diff --git a/pmd-vm/src/main/resources/category/vm/multithreading.xml b/pmd-velocity/src/main/resources/category/velocity/multithreading.xml similarity index 100% rename from pmd-vm/src/main/resources/category/vm/multithreading.xml rename to pmd-velocity/src/main/resources/category/velocity/multithreading.xml diff --git a/pmd-vm/src/main/resources/category/vm/performance.xml b/pmd-velocity/src/main/resources/category/velocity/performance.xml similarity index 100% rename from pmd-vm/src/main/resources/category/vm/performance.xml rename to pmd-velocity/src/main/resources/category/velocity/performance.xml diff --git a/pmd-vm/src/main/resources/category/vm/security.xml b/pmd-velocity/src/main/resources/category/velocity/security.xml similarity index 100% rename from pmd-vm/src/main/resources/category/vm/security.xml rename to pmd-velocity/src/main/resources/category/velocity/security.xml diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/LanguageVersionTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/LanguageVersionTest.java similarity index 60% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/LanguageVersionTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/LanguageVersionTest.java index bd51aaae2f..bcea97f9ba 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/LanguageVersionTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/LanguageVersionTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm; +package net.sourceforge.pmd.lang.velocity; import java.util.Arrays; import java.util.Collection; @@ -12,7 +12,7 @@ import net.sourceforge.pmd.test.AbstractLanguageVersionTest; class LanguageVersionTest extends AbstractLanguageVersionTest { static Collection data() { - return Arrays.asList(new TestDescriptor(VmLanguageModule.NAME, VmLanguageModule.ID, "2.3", - getLanguage(VmLanguageModule.NAME).getDefaultVersion())); + return Arrays.asList(new TestDescriptor(VtlLanguageModule.NAME, VtlLanguageModule.ID, "2.3", + getLanguage(VtlLanguageModule.NAME).getDefaultVersion())); } } diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/RuleSetFactoryTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/RuleSetFactoryTest.java similarity index 87% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/RuleSetFactoryTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/RuleSetFactoryTest.java index b549df0edd..024c5efaa9 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/RuleSetFactoryTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/RuleSetFactoryTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm; +package net.sourceforge.pmd.lang.velocity; import net.sourceforge.pmd.test.lang.rule.AbstractRuleSetFactoryTest; diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/VmParserTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/VtlParserTest.java similarity index 85% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/VmParserTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/VtlParserTest.java index 17b388fe0a..c975be39d9 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/VmParserTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/VtlParserTest.java @@ -2,14 +2,14 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm; +package net.sourceforge.pmd.lang.velocity; import org.junit.jupiter.api.Test; /** * Unit test for VM parsing. */ -class VmParserTest { +class VtlParserTest { private static final String VM_SRC = "Hello $customer.Name " + "#foreach($mud in $mudsOnSpecial)" + " #if ( $customer.hasPurchased($mud) )" + " " + "
" @@ -28,17 +28,17 @@ class VmParserTest { @Test void testParser() { - VmParsingHelper.DEFAULT.parse(VM_SRC); + VtlParsingHelper.DEFAULT.parse(VM_SRC); } @Test void testParser2() { - VmParsingHelper.DEFAULT.parse(SRC2); + VtlParsingHelper.DEFAULT.parse(SRC2); } @Test void testParser3() { - VmParsingHelper.DEFAULT.parse(SRC3); + VtlParsingHelper.DEFAULT.parse(SRC3); } } diff --git a/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/VtlParsingHelper.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/VtlParsingHelper.java new file mode 100644 index 0000000000..af7d04dde5 --- /dev/null +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/VtlParsingHelper.java @@ -0,0 +1,22 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.velocity; + +import net.sourceforge.pmd.lang.test.ast.BaseParsingHelper; +import net.sourceforge.pmd.lang.velocity.ast.ASTTemplate; + +public final class VtlParsingHelper extends BaseParsingHelper { + + public static final VtlParsingHelper DEFAULT = new VtlParsingHelper(Params.getDefault()); + + private VtlParsingHelper(Params params) { + super(VtlLanguageModule.getInstance(), ASTTemplate.class, params); + } + + @Override + protected VtlParsingHelper clone(Params params) { + return new VtlParsingHelper(params); + } +} diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/cpd/VmCpdLexerTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/cpd/VtlCpdLexerTest.java similarity index 52% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/cpd/VmCpdLexerTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/cpd/VtlCpdLexerTest.java index be9fc01a2c..d2f67a6cb5 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/cpd/VmCpdLexerTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/cpd/VtlCpdLexerTest.java @@ -2,16 +2,16 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.cpd; +package net.sourceforge.pmd.lang.velocity.cpd; import org.junit.jupiter.api.Test; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest; -import net.sourceforge.pmd.lang.vm.VmLanguageModule; +import net.sourceforge.pmd.lang.velocity.VtlLanguageModule; -class VmCpdLexerTest extends CpdTextComparisonTest { - VmCpdLexerTest() { - super(VmLanguageModule.getInstance(), ".vm"); +class VtlCpdLexerTest extends CpdTextComparisonTest { + VtlCpdLexerTest() { + super(VtlLanguageModule.getInstance(), ".vm"); } @Test diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/AvoidReassigningParametersTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/AvoidReassigningParametersTest.java similarity index 78% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/AvoidReassigningParametersTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/AvoidReassigningParametersTest.java index 3b14ac5628..14bb9756e1 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/AvoidReassigningParametersTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/AvoidReassigningParametersTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.bestpractices; +package net.sourceforge.pmd.lang.velocity.rule.bestpractices; import net.sourceforge.pmd.test.PmdRuleTst; diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/UnusedMacroParameterTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/UnusedMacroParameterTest.java similarity index 78% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/UnusedMacroParameterTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/UnusedMacroParameterTest.java index b9f961adb2..11c87c29fb 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/bestpractices/UnusedMacroParameterTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/bestpractices/UnusedMacroParameterTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.bestpractices; +package net.sourceforge.pmd.lang.velocity.rule.bestpractices; import net.sourceforge.pmd.test.PmdRuleTst; diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/AvoidDeeplyNestedIfStmtsTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/AvoidDeeplyNestedIfStmtsTest.java similarity index 80% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/AvoidDeeplyNestedIfStmtsTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/AvoidDeeplyNestedIfStmtsTest.java index 720ffeaa50..7c3c85c224 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/AvoidDeeplyNestedIfStmtsTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/AvoidDeeplyNestedIfStmtsTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.design; +package net.sourceforge.pmd.lang.velocity.rule.design; import net.sourceforge.pmd.test.PmdRuleTst; diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/CollapsibleIfStatementsTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/CollapsibleIfStatementsTest.java similarity index 80% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/CollapsibleIfStatementsTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/CollapsibleIfStatementsTest.java index a5053b4c86..c8b4828c95 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/CollapsibleIfStatementsTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/CollapsibleIfStatementsTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.design; +package net.sourceforge.pmd.lang.velocity.rule.design; import net.sourceforge.pmd.test.PmdRuleTst; diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/ExcessiveTemplateLengthTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/ExcessiveTemplateLengthTest.java similarity index 80% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/ExcessiveTemplateLengthTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/ExcessiveTemplateLengthTest.java index bb77ea067e..b03afee4f2 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/ExcessiveTemplateLengthTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/ExcessiveTemplateLengthTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.design; +package net.sourceforge.pmd.lang.velocity.rule.design; import net.sourceforge.pmd.test.PmdRuleTst; diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/NoInlineJavaScriptTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/NoInlineJavaScriptTest.java similarity index 79% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/NoInlineJavaScriptTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/NoInlineJavaScriptTest.java index a2ca069449..6787c7b04a 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/NoInlineJavaScriptTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/NoInlineJavaScriptTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.design; +package net.sourceforge.pmd.lang.velocity.rule.design; import net.sourceforge.pmd.test.PmdRuleTst; diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/NoInlineStylesTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/NoInlineStylesTest.java similarity index 79% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/NoInlineStylesTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/NoInlineStylesTest.java index 1f9592a738..f94e7ef9bc 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/design/NoInlineStylesTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/design/NoInlineStylesTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.design; +package net.sourceforge.pmd.lang.velocity.rule.design; import net.sourceforge.pmd.test.PmdRuleTst; diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyForeachStmtTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyForeachStmtTest.java similarity index 78% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyForeachStmtTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyForeachStmtTest.java index ccd9182e67..0c49151dac 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyForeachStmtTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyForeachStmtTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.errorprone; +package net.sourceforge.pmd.lang.velocity.rule.errorprone; import net.sourceforge.pmd.test.PmdRuleTst; diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyIfStmtTest.java b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyIfStmtTest.java similarity index 78% rename from pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyIfStmtTest.java rename to pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyIfStmtTest.java index 034e362b8f..76bb0d65b9 100644 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/rule/errorprone/EmptyIfStmtTest.java +++ b/pmd-velocity/src/test/java/net/sourceforge/pmd/lang/velocity/rule/errorprone/EmptyIfStmtTest.java @@ -2,7 +2,7 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.vm.rule.errorprone; +package net.sourceforge.pmd.lang.velocity.rule.errorprone; import net.sourceforge.pmd.test.PmdRuleTst; diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/cpd/testdata/sample_vm.txt b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/cpd/testdata/sample_vm.txt similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/cpd/testdata/sample_vm.txt rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/cpd/testdata/sample_vm.txt diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/cpd/testdata/sample_vm.vm b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/cpd/testdata/sample_vm.vm similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/cpd/testdata/sample_vm.vm rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/cpd/testdata/sample_vm.vm diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/bestpractices/xml/AvoidReassigningParameters.xml b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/bestpractices/xml/AvoidReassigningParameters.xml similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/bestpractices/xml/AvoidReassigningParameters.xml rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/bestpractices/xml/AvoidReassigningParameters.xml diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/bestpractices/xml/UnusedMacroParameter.xml b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/bestpractices/xml/UnusedMacroParameter.xml similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/bestpractices/xml/UnusedMacroParameter.xml rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/bestpractices/xml/UnusedMacroParameter.xml diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/design/xml/AvoidDeeplyNestedIfStmts.xml b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/design/xml/AvoidDeeplyNestedIfStmts.xml similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/design/xml/AvoidDeeplyNestedIfStmts.xml rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/design/xml/AvoidDeeplyNestedIfStmts.xml diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/design/xml/CollapsibleIfStatements.xml b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/design/xml/CollapsibleIfStatements.xml similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/design/xml/CollapsibleIfStatements.xml rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/design/xml/CollapsibleIfStatements.xml diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/design/xml/ExcessiveTemplateLength.xml b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/design/xml/ExcessiveTemplateLength.xml similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/design/xml/ExcessiveTemplateLength.xml rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/design/xml/ExcessiveTemplateLength.xml diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/design/xml/NoInlineJavaScript.xml b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/design/xml/NoInlineJavaScript.xml similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/design/xml/NoInlineJavaScript.xml rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/design/xml/NoInlineJavaScript.xml diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/design/xml/NoInlineStyles.xml b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/design/xml/NoInlineStyles.xml similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/design/xml/NoInlineStyles.xml rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/design/xml/NoInlineStyles.xml diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/errorprone/xml/EmptyForeachStmt.xml b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/errorprone/xml/EmptyForeachStmt.xml similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/errorprone/xml/EmptyForeachStmt.xml rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/errorprone/xml/EmptyForeachStmt.xml diff --git a/pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/errorprone/xml/EmptyIfStmt.xml b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/errorprone/xml/EmptyIfStmt.xml similarity index 100% rename from pmd-vm/src/test/resources/net/sourceforge/pmd/lang/vm/rule/errorprone/xml/EmptyIfStmt.xml rename to pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/rule/errorprone/xml/EmptyIfStmt.xml diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmHandler.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmHandler.java deleted file mode 100644 index cac346da69..0000000000 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * BSD-style license; for more info see http://pmd.sourceforge.net/license.html - */ - -package net.sourceforge.pmd.lang.vm; - -import net.sourceforge.pmd.lang.AbstractPmdLanguageVersionHandler; -import net.sourceforge.pmd.lang.ast.Parser; -import net.sourceforge.pmd.lang.vm.ast.VmParser; - -/** - * Implementation of LanguageVersionHandler for the VM parser. - * - */ -public class VmHandler extends AbstractPmdLanguageVersionHandler { - - - @Override - public Parser getParser() { - return new VmParser(); - } - -} diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmVisitorBase.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmVisitorBase.java deleted file mode 100644 index db58f9bb9c..0000000000 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmVisitorBase.java +++ /dev/null @@ -1,12 +0,0 @@ -/* - * BSD-style license; for more info see http://pmd.sourceforge.net/license.html - */ - -package net.sourceforge.pmd.lang.vm.ast; - - -import net.sourceforge.pmd.lang.ast.AstVisitorBase; - -public abstract class VmVisitorBase extends AstVisitorBase implements VmVisitor { - -} diff --git a/pmd-vm/src/main/resources/META-INF/services/net.sourceforge.pmd.lang.Language b/pmd-vm/src/main/resources/META-INF/services/net.sourceforge.pmd.lang.Language deleted file mode 100644 index aa6c6924ac..0000000000 --- a/pmd-vm/src/main/resources/META-INF/services/net.sourceforge.pmd.lang.Language +++ /dev/null @@ -1 +0,0 @@ -net.sourceforge.pmd.lang.vm.VmLanguageModule diff --git a/pmd-vm/src/main/resources/category/vm/categories.properties b/pmd-vm/src/main/resources/category/vm/categories.properties deleted file mode 100644 index ea336212f6..0000000000 --- a/pmd-vm/src/main/resources/category/vm/categories.properties +++ /dev/null @@ -1,17 +0,0 @@ -# -# BSD-style license; for more info see http://pmd.sourceforge.net/license.html -# - -rulesets.filenames=\ - category/vm/bestpractices.xml,\ - category/vm/design.xml,\ - category/vm/errorprone.xml - -# -# categories without rules -# -# category/vm/codestyle.xml -# category/vm/documentation.xml -# category/vm/multithreading.xml -# category/vm/performance.xml -# category/vm/security.xml diff --git a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/VmParsingHelper.java b/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/VmParsingHelper.java deleted file mode 100644 index 6ce7377671..0000000000 --- a/pmd-vm/src/test/java/net/sourceforge/pmd/lang/vm/VmParsingHelper.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * BSD-style license; for more info see http://pmd.sourceforge.net/license.html - */ - -package net.sourceforge.pmd.lang.vm; - -import net.sourceforge.pmd.lang.test.ast.BaseParsingHelper; -import net.sourceforge.pmd.lang.vm.ast.ASTTemplate; - -public final class VmParsingHelper extends BaseParsingHelper { - - public static final VmParsingHelper DEFAULT = new VmParsingHelper(Params.getDefault()); - - private VmParsingHelper(Params params) { - super(VmLanguageModule.getInstance(), ASTTemplate.class, params); - } - - @Override - protected VmParsingHelper clone(Params params) { - return new VmParsingHelper(params); - } -} diff --git a/pom.xml b/pom.xml index e37389959f..d5b2f51565 100644 --- a/pom.xml +++ b/pom.xml @@ -1282,8 +1282,8 @@ pmd-test pmd-test-schema pmd-tsql + pmd-velocity pmd-visualforce - pmd-vm pmd-xml pmd-ant pmd-languages-deps