Upgrade to PMD 7.0.0-rc3

This commit is contained in:
Erik C. Thauvin 2023-08-11 16:30:25 -07:00
parent 137a8b1849
commit bc091e44c5
3 changed files with 5 additions and 28 deletions

View file

@ -14,7 +14,6 @@ import static rife.bld.dependencies.Scope.runtime;
import static rife.bld.dependencies.Scope.test;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class PmdOperationBuild extends Project {
public PmdOperationBuild() {
pkg = "rife.bld.extension";
@ -26,7 +25,7 @@ public class PmdOperationBuild extends Project {
autoDownloadPurge = true;
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
var pmd = version(7, 0, 0, "rc2");
var pmd = version(7, 0, 0, "rc3");
var rife2 = version(1,7,0);
scope(compile)
.include(dependency("com.uwyn.rife2", "rife2", rife2))
@ -36,8 +35,8 @@ public class PmdOperationBuild extends Project {
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd))
.include(dependency("org.slf4j", "slf4j-simple", version(2,0,7)));
scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 3)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 3)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)))
.include(dependency("org.assertj:assertj-joda-time:2.2.0"));
javadocOperation()

View file

@ -66,10 +66,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* The cache location.
*/
Path cache;
/**
* The debug toggle.
*/
boolean debug;
/**
* The encoding.
*/
@ -174,14 +170,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this;
}
/**
* Enables or disables debug logging mode.
*/
public PmdOperation debug(boolean debug) {
this.debug = debug;
return this;
}
/**
* Sets the default language to be used for all input files.
*/
@ -202,11 +190,9 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
/**
* Performs the PMD code analysis operation.
*
* @throws Exception when an exception occurs during the execution
*/
@Override
public void execute() throws Exception {
public void execute() {
if (project == null) {
throw new IllegalArgumentException("ERROR: project required.");
}
@ -286,7 +272,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
config.setAnalysisCacheLocation(cache.toFile().getAbsolutePath());
}
config.setDebug(debug);
config.setFailOnViolation(failOnViolation);
if (languageVersions != null) {
@ -363,7 +348,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
for (var v : report.getViolations()) {
if (LOGGER.isLoggable(Level.WARNING)) {
LOGGER.log(Level.WARNING, "[{0}] {1}:{2}:\n\t{3} ({4})\n\t\t--> {5}",
new Object[]{commandName, Paths.get(v.getFilename()).toUri(), v.getBeginLine(),
new Object[]{commandName, Paths.get(v.getFileId().getFileName()).toUri(), v.getBeginLine(),
v.getRule().getName(),
v.getRule().getExternalInfoUrl() //TODO bug in PMD?
.replace("${pmd.website.baseurl}",

View file

@ -72,13 +72,6 @@ class PmdOperationTest {
assertThat(f.delete()).as("delete file").isTrue();
}
@Test
void testDebug() {
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).debug(true);
var config = pmd.initConfiguration(COMMAND_NAME);
assertThat(config.isDebug()).isTrue();
}
@Test
void testEncoding() {
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).encoding("UTF-16");