[doc] Fix rule doc generation and dead links
- previous existing rule docs will be deleted now
This commit is contained in:
parent
1aa6112aae
commit
7813f544e3
@ -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:
|
||||
|
@ -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).
|
||||
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -90,6 +90,7 @@ public class RuleDocGenerator {
|
||||
}
|
||||
|
||||
public void generate(List<RuleSet> registeredRulesets, List<String> additionalRulesets) throws IOException {
|
||||
removeExistingRuleDocs();
|
||||
Map<Language, List<RuleSet>> sortedRulesets;
|
||||
Map<Language, List<RuleSet>> 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<Path>() {
|
||||
@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<Language, List<RuleSet>> sortedRulesets) {
|
||||
for (Language language : LanguageRegistry.PMD.getLanguages()) {
|
||||
sortedRulesets.putIfAbsent(language, Collections.emptyList());
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user