[doc] List all languages in rule doc
Even without rules. - Relates #4205 - Relates #4105
This commit is contained in:
@ -307,6 +307,15 @@ entries:
|
|||||||
- title: Security
|
- title: Security
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
url: /pmd_rules_vf_security.html
|
url: /pmd_rules_vf_security.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: Scala Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_scala.html
|
||||||
- title: null
|
- title: null
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
subfolders:
|
subfolders:
|
||||||
@ -325,6 +334,15 @@ entries:
|
|||||||
- title: Error Prone
|
- title: Error Prone
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
url: /pmd_rules_vm_errorprone.html
|
url: /pmd_rules_vm_errorprone.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: WSDL Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_wsdl.html
|
||||||
- title: null
|
- title: null
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
subfolders:
|
subfolders:
|
||||||
|
@ -38,6 +38,7 @@ import net.sourceforge.pmd.RuleSet;
|
|||||||
import net.sourceforge.pmd.RuleSetLoadException;
|
import net.sourceforge.pmd.RuleSetLoadException;
|
||||||
import net.sourceforge.pmd.RuleSetLoader;
|
import net.sourceforge.pmd.RuleSetLoader;
|
||||||
import net.sourceforge.pmd.lang.Language;
|
import net.sourceforge.pmd.lang.Language;
|
||||||
|
import net.sourceforge.pmd.lang.LanguageRegistry;
|
||||||
import net.sourceforge.pmd.lang.rule.RuleReference;
|
import net.sourceforge.pmd.lang.rule.RuleReference;
|
||||||
import net.sourceforge.pmd.lang.rule.XPathRule;
|
import net.sourceforge.pmd.lang.rule.XPathRule;
|
||||||
import net.sourceforge.pmd.properties.MultiValuePropertyDescriptor;
|
import net.sourceforge.pmd.properties.MultiValuePropertyDescriptor;
|
||||||
@ -99,9 +100,16 @@ public class RuleDocGenerator {
|
|||||||
generateLanguageIndex(sortedRulesets, sortedAdditionalRulesets);
|
generateLanguageIndex(sortedRulesets, sortedAdditionalRulesets);
|
||||||
generateRuleSetIndex(sortedRulesets);
|
generateRuleSetIndex(sortedRulesets);
|
||||||
|
|
||||||
|
ensureAllLanguages(sortedRulesets);
|
||||||
generateSidebar(sortedRulesets);
|
generateSidebar(sortedRulesets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ensureAllLanguages(Map<Language, List<RuleSet>> sortedRulesets) {
|
||||||
|
for (Language language : LanguageRegistry.findWithRuleSupport()) {
|
||||||
|
sortedRulesets.putIfAbsent(language, Collections.emptyList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void generateSidebar(Map<Language, List<RuleSet>> sortedRulesets) throws IOException {
|
private void generateSidebar(Map<Language, List<RuleSet>> sortedRulesets) throws IOException {
|
||||||
SidebarGenerator generator = new SidebarGenerator(writer, root);
|
SidebarGenerator generator = new SidebarGenerator(writer, root);
|
||||||
generator.generateSidebar(sortedRulesets);
|
generator.generateSidebar(sortedRulesets);
|
||||||
|
@ -11,9 +11,9 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.nio.file.FileSystems;
|
import java.nio.file.FileSystems;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.apache.commons.lang3.SystemUtils;
|
import org.apache.commons.lang3.SystemUtils;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -39,11 +39,12 @@ public class SidebarGeneratorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSidebar() throws IOException {
|
public void testSidebar() throws IOException {
|
||||||
Map<Language, List<RuleSet>> rulesets = new HashMap<>();
|
Map<Language, List<RuleSet>> rulesets = new TreeMap<>();
|
||||||
RuleSet ruleSet1 = RulesetsFactoryUtils.defaultFactory().createNewRuleSet("test", "test", "bestpractices.xml", Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
|
RuleSet ruleSet1 = RulesetsFactoryUtils.defaultFactory().createNewRuleSet("test", "test", "bestpractices.xml", Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
|
||||||
RuleSet ruleSet2 = RulesetsFactoryUtils.defaultFactory().createNewRuleSet("test2", "test", "codestyle.xml", Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
|
RuleSet ruleSet2 = RulesetsFactoryUtils.defaultFactory().createNewRuleSet("test2", "test", "codestyle.xml", Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
|
||||||
rulesets.put(LanguageRegistry.findLanguageByTerseName("java"), Arrays.asList(ruleSet1, ruleSet2));
|
rulesets.put(LanguageRegistry.findLanguageByTerseName("java"), Arrays.asList(ruleSet1, ruleSet2));
|
||||||
rulesets.put(LanguageRegistry.findLanguageByTerseName("ecmascript"), Arrays.asList(ruleSet1));
|
rulesets.put(LanguageRegistry.findLanguageByTerseName("ecmascript"), Arrays.asList(ruleSet1));
|
||||||
|
rulesets.put(LanguageRegistry.findLanguageByTerseName("scala"), Collections.emptyList());
|
||||||
|
|
||||||
SidebarGenerator generator = new SidebarGenerator(writer, FileSystems.getDefault().getPath(".."));
|
SidebarGenerator generator = new SidebarGenerator(writer, FileSystems.getDefault().getPath(".."));
|
||||||
List<Map<String, Object>> result = generator.generateRuleReferenceSection(rulesets);
|
List<Map<String, Object>> result = generator.generateRuleReferenceSection(rulesets);
|
||||||
|
@ -6,6 +6,33 @@ entries:
|
|||||||
- title: 3
|
- title: 3
|
||||||
- title: Rules
|
- title: Rules
|
||||||
folderitems:
|
folderitems:
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: Apex Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_apex.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: Ecmascript Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_ecmascript.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: HTML Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_html.html
|
||||||
- title: null
|
- title: null
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
subfolders:
|
subfolders:
|
||||||
@ -18,3 +45,93 @@ entries:
|
|||||||
- title: Sample
|
- title: Sample
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
url: /pmd_rules_java_sample.html
|
url: /pmd_rules_java_sample.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: Java Server Pages Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_jsp.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: Maven POM Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_pom.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: Modelica Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_modelica.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: PLSQL Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_plsql.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: Salesforce VisualForce Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_vf.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: Scala Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_scala.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: VM Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_vm.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: WSDL Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_wsdl.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: XML Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_xml.html
|
||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: XSL Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_xsl.html
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
- title: null
|
||||||
|
output: web, pdf
|
||||||
|
subfolders:
|
||||||
|
- title: Ecmascript Rules
|
||||||
|
output: web, pdf
|
||||||
|
subfolderitems:
|
||||||
|
- title: Index
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_ecmascript.html
|
||||||
|
- title: test
|
||||||
|
output: web, pdf
|
||||||
|
url: /pmd_rules_ecmascript_bestpractices.html
|
||||||
- title: null
|
- title: null
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
subfolders:
|
subfolders:
|
||||||
@ -16,12 +28,9 @@
|
|||||||
- title: null
|
- title: null
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
subfolders:
|
subfolders:
|
||||||
- title: Ecmascript Rules
|
- title: Scala Rules
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
subfolderitems:
|
subfolderitems:
|
||||||
- title: Index
|
- title: Index
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
url: /pmd_rules_ecmascript.html
|
url: /pmd_rules_scala.html
|
||||||
- title: test
|
|
||||||
output: web, pdf
|
|
||||||
url: /pmd_rules_ecmascript_bestpractices.html
|
|
||||||
|
Reference in New Issue
Block a user