diff --git a/pmd-core/src/main/resources/rulesets/releases/510.xml b/pmd-core/src/main/resources/rulesets/releases/510.xml index 62349ba42b..f3cbbe9dd1 100644 --- a/pmd-core/src/main/resources/rulesets/releases/510.xml +++ b/pmd-core/src/main/resources/rulesets/releases/510.xml @@ -31,14 +31,14 @@ This ruleset contains links to rules that are new in PMD v5.1.0 - - - - - - - - - + + + + + + + + + diff --git a/pmd-core/src/main/resources/rulesets/releases/550.xml b/pmd-core/src/main/resources/rulesets/releases/550.xml index f5ca3d297f..f270a52b5e 100644 --- a/pmd-core/src/main/resources/rulesets/releases/550.xml +++ b/pmd-core/src/main/resources/rulesets/releases/550.xml @@ -20,7 +20,7 @@ This ruleset contains links to rules that are new in PMD v5.5.0 - + diff --git a/pmd-core/src/main/resources/rulesets/releases/600.xml b/pmd-core/src/main/resources/rulesets/releases/600.xml index bdc85024fc..f2c145af90 100644 --- a/pmd-core/src/main/resources/rulesets/releases/600.xml +++ b/pmd-core/src/main/resources/rulesets/releases/600.xml @@ -8,7 +8,7 @@ This ruleset contains links to rules that are new in PMD v6.0.0 - + diff --git a/pmd-doc/src/test/java/net/sourceforge/pmd/docs/RuleSetResolverTest.java b/pmd-doc/src/test/java/net/sourceforge/pmd/docs/RuleSetResolverTest.java new file mode 100644 index 0000000000..fd638da505 --- /dev/null +++ b/pmd-doc/src/test/java/net/sourceforge/pmd/docs/RuleSetResolverTest.java @@ -0,0 +1,57 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.docs; + +import static org.junit.Assert.fail; + +import java.nio.file.FileSystems; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.junit.Test; + +import net.sourceforge.pmd.RuleSetFactory; +import net.sourceforge.pmd.RuleSetNotFoundException; + +public class RuleSetResolverTest { + + private static List excludedRulesets = new ArrayList<>(); + + static { + excludedRulesets.add("pmd-test/src/main/resources/rulesets/dummy/basic.xml"); + } + + @Test + public void resolveAllRulesets() { + Path basePath = FileSystems.getDefault().getPath(".").resolve("..").toAbsolutePath().normalize(); + List additionalRulesets = GenerateRuleDocsCmd.findAdditionalRulesets(basePath); + + filterRuleSets(additionalRulesets); + + RuleSetFactory ruleSetFactory = new RuleSetFactory(); + for (String filename : additionalRulesets) { + try { + ruleSetFactory.createRuleSet(filename); + } catch (RuntimeException | RuleSetNotFoundException e) { + fail("Couldn't load ruleset " + filename + ": " + e.getMessage()); + } + } + } + + private void filterRuleSets(List additionalRulesets) { + Iterator it = additionalRulesets.iterator(); + while (it.hasNext()) { + String filename = it.next(); + for (String exclusion : excludedRulesets) { + if (filename.endsWith(exclusion)) { + it.remove(); + break; + } + } + } + } +} diff --git a/pmd-java/src/main/resources/rulesets/java/naming.xml b/pmd-java/src/main/resources/rulesets/java/naming.xml index 4194356211..695fe89e02 100644 --- a/pmd-java/src/main/resources/rulesets/java/naming.xml +++ b/pmd-java/src/main/resources/rulesets/java/naming.xml @@ -23,6 +23,8 @@ The Naming Ruleset contains rules regarding preferred usage of names and identif + + diff --git a/pmd-visualforce/src/main/resources/rulesets/vf/security.xml b/pmd-visualforce/src/main/resources/rulesets/vf/security.xml index 54c11bc7d8..2e6d14462d 100644 --- a/pmd-visualforce/src/main/resources/rulesets/vf/security.xml +++ b/pmd-visualforce/src/main/resources/rulesets/vf/security.xml @@ -8,7 +8,7 @@ Rules concerning basic VF guidelines. - - + +