Compare commits
3 Commits
main
...
pmd_releas
Author | SHA1 | Date | |
---|---|---|---|
|
c49d3d61a9 | ||
|
c1140fd3b8 | ||
|
6032236bb0 |
@ -11,7 +11,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>pmd-compat6</artifactId>
|
||||
<version>7.0.0-rc4</version>
|
||||
<version>7.0.0-rc4+with-pr4749</version>
|
||||
<name>PMD Compatibility Classes for PMD6</name>
|
||||
|
||||
<properties>
|
||||
@ -21,7 +21,7 @@
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
<tag>pmd_releases/7.0.0-rc4-pmd-compat6</tag>
|
||||
<tag>pmd_releases/7.0.0-rc4-pmd-compat6+with-pr4749</tag>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
16
pmd-compat6/src/it/pmd-for-java/exception_ruleset.xml
Normal file
16
pmd-compat6/src/it/pmd-for-java/exception_ruleset.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" name="Exception throwing ruleset">
|
||||
<description/>
|
||||
<rule name="ExceptionThrowingRule"
|
||||
language="java"
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule">
|
||||
<description>Use this rule to produce a processing error.</description>
|
||||
<priority>3</priority>
|
||||
<properties>
|
||||
<property name="xpath">
|
||||
<value><![CDATA[
|
||||
error()
|
||||
]]></value></property>
|
||||
</properties>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
@ -30,8 +30,12 @@
|
||||
</executions>
|
||||
<configuration>
|
||||
<printFailingErrors>true</printFailingErrors>
|
||||
<skipPmdError>false</skipPmdError>
|
||||
<skipPmdError>true</skipPmdError> <!-- we want to capture processing errors -->
|
||||
<minimumTokens>5</minimumTokens>
|
||||
<rulesets>
|
||||
<ruleset>/rulesets/java/maven-pmd-plugin-default.xml</ruleset>
|
||||
<ruleset>${project.basedir}/exception_ruleset.xml</ruleset>
|
||||
</rulesets>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -29,10 +29,13 @@ String pmdXml = readFile(pmdXmlReport);
|
||||
if (!pmdXml.contains("<violation beginline=\"5\" endline=\"5\" begincolumn=\"16\" endcolumn=\"37\" rule=\"UnusedLocalVariable\" ruleset=\"Best Practices\" package=\"org.example\" class=\"Main\" method=\"main\" variable=\"thisIsAUnusedLocalVar\"")) {
|
||||
throw new RuntimeException("Expected violation has not been reported");
|
||||
}
|
||||
File mainFile = new File("pmd-for-java/src/main/java/org/example/Main.java");
|
||||
File mainFile = new File(basedir, "src/main/java/org/example/Main.java");
|
||||
if (!pmdXml.contains(mainFile + "\">")) {
|
||||
throw new RuntimeException("Expected violation has not been reported");
|
||||
}
|
||||
if (!pmdXml.contains("<error filename=\"" + mainFile.getAbsolutePath()) || !pmdXml.contains(mainFile + "\" msg=\"PmdXPathException")) {
|
||||
throw new RuntimeException("Processing error has not been reported");
|
||||
}
|
||||
|
||||
File pmdCsvReport = new File(basedir, "target/pmd.csv");
|
||||
if (!pmdCsvReport.exists()) {
|
||||
|
@ -143,6 +143,11 @@ public final class Report {
|
||||
public Throwable getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
// ------------------- compat extensions --------------------
|
||||
public String getFile() {
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user