Upgrade to PMD 7.0.0-rc3
This commit is contained in:
parent
137a8b1849
commit
bc091e44c5
3 changed files with 5 additions and 28 deletions
|
@ -14,7 +14,6 @@ import static rife.bld.dependencies.Scope.runtime;
|
||||||
import static rife.bld.dependencies.Scope.test;
|
import static rife.bld.dependencies.Scope.test;
|
||||||
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
||||||
|
|
||||||
|
|
||||||
public class PmdOperationBuild extends Project {
|
public class PmdOperationBuild extends Project {
|
||||||
public PmdOperationBuild() {
|
public PmdOperationBuild() {
|
||||||
pkg = "rife.bld.extension";
|
pkg = "rife.bld.extension";
|
||||||
|
@ -26,7 +25,7 @@ public class PmdOperationBuild extends Project {
|
||||||
autoDownloadPurge = true;
|
autoDownloadPurge = true;
|
||||||
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
|
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);
|
var rife2 = version(1,7,0);
|
||||||
scope(compile)
|
scope(compile)
|
||||||
.include(dependency("com.uwyn.rife2", "rife2", rife2))
|
.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("net.sourceforge.pmd", "pmd-java", pmd))
|
||||||
.include(dependency("org.slf4j", "slf4j-simple", version(2,0,7)));
|
.include(dependency("org.slf4j", "slf4j-simple", version(2,0,7)));
|
||||||
scope(test)
|
scope(test)
|
||||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 3)))
|
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
|
||||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 3)))
|
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)))
|
||||||
.include(dependency("org.assertj:assertj-joda-time:2.2.0"));
|
.include(dependency("org.assertj:assertj-joda-time:2.2.0"));
|
||||||
|
|
||||||
javadocOperation()
|
javadocOperation()
|
||||||
|
|
|
@ -66,10 +66,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
|
||||||
* The cache location.
|
* The cache location.
|
||||||
*/
|
*/
|
||||||
Path cache;
|
Path cache;
|
||||||
/**
|
|
||||||
* The debug toggle.
|
|
||||||
*/
|
|
||||||
boolean debug;
|
|
||||||
/**
|
/**
|
||||||
* The encoding.
|
* The encoding.
|
||||||
*/
|
*/
|
||||||
|
@ -174,14 +170,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
|
||||||
return this;
|
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.
|
* 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.
|
* Performs the PMD code analysis operation.
|
||||||
*
|
|
||||||
* @throws Exception when an exception occurs during the execution
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws Exception {
|
public void execute() {
|
||||||
if (project == null) {
|
if (project == null) {
|
||||||
throw new IllegalArgumentException("ERROR: project required.");
|
throw new IllegalArgumentException("ERROR: project required.");
|
||||||
}
|
}
|
||||||
|
@ -286,7 +272,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
|
||||||
config.setAnalysisCacheLocation(cache.toFile().getAbsolutePath());
|
config.setAnalysisCacheLocation(cache.toFile().getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
config.setDebug(debug);
|
|
||||||
config.setFailOnViolation(failOnViolation);
|
config.setFailOnViolation(failOnViolation);
|
||||||
|
|
||||||
if (languageVersions != null) {
|
if (languageVersions != null) {
|
||||||
|
@ -363,7 +348,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
|
||||||
for (var v : report.getViolations()) {
|
for (var v : report.getViolations()) {
|
||||||
if (LOGGER.isLoggable(Level.WARNING)) {
|
if (LOGGER.isLoggable(Level.WARNING)) {
|
||||||
LOGGER.log(Level.WARNING, "[{0}] {1}:{2}:\n\t{3} ({4})\n\t\t--> {5}",
|
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().getName(),
|
||||||
v.getRule().getExternalInfoUrl() //TODO bug in PMD?
|
v.getRule().getExternalInfoUrl() //TODO bug in PMD?
|
||||||
.replace("${pmd.website.baseurl}",
|
.replace("${pmd.website.baseurl}",
|
||||||
|
|
|
@ -72,13 +72,6 @@ class PmdOperationTest {
|
||||||
assertThat(f.delete()).as("delete file").isTrue();
|
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
|
@Test
|
||||||
void testEncoding() {
|
void testEncoding() {
|
||||||
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).encoding("UTF-16");
|
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).encoding("UTF-16");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue