diff --git a/docs/_data/sidebars/pmd_sidebar.yml b/docs/_data/sidebars/pmd_sidebar.yml index 247c6fae94..1902b8761d 100644 --- a/docs/_data/sidebars/pmd_sidebar.yml +++ b/docs/_data/sidebars/pmd_sidebar.yml @@ -324,10 +324,10 @@ entries: subfolderitems: - title: Index output: web, pdf - url: /pmd_rules_vf.html + url: /pmd_rules_visualforce.html - title: Security output: web, pdf - url: /pmd_rules_vf_security.html + url: /pmd_rules_visualforce_security.html - title: null output: web, pdf subfolders: @@ -360,16 +360,16 @@ entries: subfolderitems: - title: Index output: web, pdf - url: /pmd_rules_vm.html + url: /pmd_rules_velocity.html - title: Best Practices output: web, pdf - url: /pmd_rules_vm_bestpractices.html + url: /pmd_rules_velocity_bestpractices.html - title: Design output: web, pdf - url: /pmd_rules_vm_design.html + url: /pmd_rules_velocity_design.html - title: Error Prone output: web, pdf - url: /pmd_rules_vm_errorprone.html + url: /pmd_rules_velocity_errorprone.html - title: null output: web, pdf subfolders: diff --git a/docs/pages/pmd/devdocs/major_contributions/adding_new_cpd_language.md b/docs/pages/pmd/devdocs/major_contributions/adding_new_cpd_language.md index 9261c50e18..5238f752a0 100644 --- a/docs/pages/pmd/devdocs/major_contributions/adding_new_cpd_language.md +++ b/docs/pages/pmd/devdocs/major_contributions/adding_new_cpd_language.md @@ -75,7 +75,7 @@ If your language only supports CPD, then you can subclass {% jdoc core::lang.imp At this point the new language module should be available in {% jdoc core::lang.LanguageRegistry#CPD %} and usable by CPD like any other language. -4. Update the test that asserts the list of supported languages by updating the `SUPPORTED_LANGUAGES` constant in [BinaryDistributionIT](https://github.com/pmd/pmd/blob/master/pmd-dist/src/test/java/net/sourceforge/pmd/it/BinaryDistributionIT.java). +4. Update the test that asserts the list of supported languages by updating the `SUPPORTED_LANGUAGES` constant in [BinaryDistributionIT](https://github.com/pmd/pmd/blob/master/pmd-dist/src/test/java/net/sourceforge/pmd/dist/BinaryDistributionIT.java). 5. Add some tests for your CpdLexer by following the [section below](#testing-your-implementation). diff --git a/docs/pages/pmd/languages/visualforce.md b/docs/pages/pmd/languages/visualforce.md index 0bffab4e5b..0f9809a1da 100644 --- a/docs/pages/pmd/languages/visualforce.md +++ b/docs/pages/pmd/languages/visualforce.md @@ -28,7 +28,7 @@ Since PMD 6.30.0 support for type resolution has been added. The Visualforce AST now can resolve the data type of Visualforce expressions that reference Apex Controller properties and Custom Object fields. This feature improves the precision of existing rules, -like {% rule vf/security/VfUnescapeEl %}. +like {% rule visualforce/security/VfUnescapeEl %}. This can be configured using two language properties, which can be set as environment variables: diff --git a/docs/pages/pmd/userdocs/cli_reference.md b/docs/pages/pmd/userdocs/cli_reference.md index 28a6978ac7..a190504225 100644 --- a/docs/pages/pmd/userdocs/cli_reference.md +++ b/docs/pages/pmd/userdocs/cli_reference.md @@ -263,8 +263,8 @@ Example: * [pom](pmd_rules_pom.html) (Maven POM) * [scala](pmd_rules_scala.html) * [swift](pmd_rules_swift.html) -* [vf](pmd_rules_vf.html) (Salesforce VisualForce) -* [vm](pmd_rules_vm.html) (Apache Velocity) +* [velocity](pmd_rules_velocity.html) (Apache Velocity Template Language) +* [visualforce](pmd_rules_visualforce.html) (Salesforce VisualForce) * [xml](pmd_rules_xml.html) * [xsl](pmd_rules_xsl.html) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 425493360e..1c9cec1674 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -1138,7 +1138,7 @@ Contributors: [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-g {% rule plsql/design/ExcessiveParameterList %}, {% rule plsql/design/ExcessiveTypeLength %}, {% rule plsql/design/NcssMethodCount %}, {% rule plsql/design/NcssObjectCount %}, {% rule plsql/design/NPathComplexity %} - * VM: {% rule vm/design/ExcessiveTemplateLength %} + * Velocity: {% rule velocity/design/ExcessiveTemplateLength %} * The general property `violationSuppressXPath` which is available for all rules to [suppress warnings]({{ baseurl }}pmd_userdocs_suppressing_warnings.html) now uses XPath version 3.1 by default. diff --git a/docs/pages/release_notes_pmd7.md b/docs/pages/release_notes_pmd7.md index a0ddd27183..8c7c35526f 100644 --- a/docs/pages/release_notes_pmd7.md +++ b/docs/pages/release_notes_pmd7.md @@ -330,7 +330,7 @@ can be parsed now. PMD should now be able to parse Apex code up to version 59.0 {% rule plsql/design/ExcessiveParameterList %}, {% rule plsql/design/ExcessiveTypeLength %}, {% rule plsql/design/NcssMethodCount %}, {% rule plsql/design/NcssObjectCount %}, {% rule plsql/design/NPathComplexity %} - * VM: {% rule vm/design/ExcessiveTemplateLength %} + * Velocity: {% rule velocity/design/ExcessiveTemplateLength %} * The general property `violationSuppressXPath` which is available for all rules to [suppress warnings](pmd_userdocs_suppressing_warnings.html) now uses XPath version 3.1 by default. diff --git a/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/RuleDocGenerator.java b/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/RuleDocGenerator.java index cdaec8328e..5ad83287e4 100644 --- a/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/RuleDocGenerator.java +++ b/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/RuleDocGenerator.java @@ -90,6 +90,7 @@ public class RuleDocGenerator { } public void generate(List registeredRulesets, List additionalRulesets) throws IOException { + removeExistingRuleDocs(); Map> sortedRulesets; Map> sortedAdditionalRulesets; sortedRulesets = sortRulesets(registeredRulesets); @@ -102,6 +103,38 @@ public class RuleDocGenerator { generateSidebar(sortedRulesets); } + private void removeExistingRuleDocs() throws IOException { + Path directory = root.resolve("docs/pages/pmd/rules"); + if (!Files.isDirectory(directory)) { + // no old files exist yet + return; + } + + System.out.println("Deleting old rule docs in " + directory); + Files.walkFileTree(directory, new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + if (file.toString().endsWith("scala.md")) { + // don't delete scala.md, since we don't have any rules yet... + return FileVisitResult.CONTINUE; + } + Files.delete(file); + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + if (dir.equals(directory)) { + // don't delete the whole directory, keep it empty + // or almost empty (scala.md is still present) + return FileVisitResult.CONTINUE; + } + Files.delete(dir); + return FileVisitResult.CONTINUE; + } + }); + } + private void ensureAllLanguages(Map> sortedRulesets) { for (Language language : LanguageRegistry.PMD.getLanguages()) { sortedRulesets.putIfAbsent(language, Collections.emptyList()); diff --git a/pmd-doc/src/test/resources/expected/pmd_sidebar.yml b/pmd-doc/src/test/resources/expected/pmd_sidebar.yml index 756c9ece74..dc489db83f 100644 --- a/pmd-doc/src/test/resources/expected/pmd_sidebar.yml +++ b/pmd-doc/src/test/resources/expected/pmd_sidebar.yml @@ -98,7 +98,7 @@ entries: subfolderitems: - title: Index output: web, pdf - url: /pmd_rules_vf.html + url: /pmd_rules_visualforce.html - title: null output: web, pdf subfolders: @@ -125,7 +125,7 @@ entries: subfolderitems: - title: Index output: web, pdf - url: /pmd_rules_vm.html + url: /pmd_rules_velocity.html - title: null output: web, pdf subfolders: