Use explicit encoding in ruleset files
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Best Practices"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Code Style"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Design"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Documentation"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Error Prone"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Multithreading"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Performance"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Security"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -9,12 +9,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import net.sourceforge.pmd.AbstractRuleSetFactoryTest;
|
||||
import net.sourceforge.pmd.RuleSet;
|
||||
import net.sourceforge.pmd.RuleSetLoader;
|
||||
|
||||
import com.github.stefanbirkner.systemlambda.SystemLambda;
|
||||
|
||||
class DefaultRulesetTest {
|
||||
private static final String QUICKSTART_RULESET = "rulesets/apex/quickstart.xml";
|
||||
|
||||
@Test
|
||||
void loadDefaultRuleset() {
|
||||
@ -25,12 +27,17 @@ class DefaultRulesetTest {
|
||||
@Test
|
||||
void loadQuickstartRuleset() throws Exception {
|
||||
String log = SystemLambda.tapSystemErr(() -> {
|
||||
RuleSet ruleset = rulesetLoader().loadFromResource("rulesets/apex/quickstart.xml");
|
||||
RuleSet ruleset = rulesetLoader().loadFromResource(QUICKSTART_RULESET);
|
||||
assertNotNull(ruleset);
|
||||
});
|
||||
assertTrue(log.isEmpty(), "No Logging expected");
|
||||
}
|
||||
|
||||
@Test
|
||||
void correctEncoding() throws Exception {
|
||||
assertTrue(AbstractRuleSetFactoryTest.hasCorrectEncoding(QUICKSTART_RULESET));
|
||||
}
|
||||
|
||||
private RuleSetLoader rulesetLoader() {
|
||||
return new RuleSetLoader().enableCompatibility(false);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Best Practices"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Code Style"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Design"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Documentation"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Error Prone"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Multithreading"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Performance"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Security"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Best Practices"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Code Style"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Design"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Documentation"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Error Prone"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Multithreading"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Performance"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Security" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset name="quickstart"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
|
@ -9,20 +9,27 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import net.sourceforge.pmd.AbstractRuleSetFactoryTest;
|
||||
import net.sourceforge.pmd.RuleSet;
|
||||
import net.sourceforge.pmd.RuleSetLoader;
|
||||
|
||||
import com.github.stefanbirkner.systemlambda.SystemLambda;
|
||||
|
||||
class QuickstartRulesetTest {
|
||||
private static final String QUICKSTART_RULESET = "rulesets/java/quickstart.xml";
|
||||
|
||||
@Test
|
||||
void noDeprecations() throws Exception {
|
||||
RuleSetLoader ruleSetLoader = new RuleSetLoader().enableCompatibility(false);
|
||||
String errorOutput = SystemLambda.tapSystemErr(() -> {
|
||||
RuleSet quickstart = ruleSetLoader.loadFromResource("rulesets/java/quickstart.xml");
|
||||
RuleSet quickstart = ruleSetLoader.loadFromResource(QUICKSTART_RULESET);
|
||||
assertFalse(quickstart.getRules().isEmpty());
|
||||
});
|
||||
assertTrue(errorOutput.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void correctEncoding() throws Exception {
|
||||
assertTrue(AbstractRuleSetFactoryTest.hasCorrectEncoding(QUICKSTART_RULESET));
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Best Practices"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Code Style"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ruleset name="Design"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user