Upgraded to PMD 7.0.0-rc4
This commit is contained in:
parent
69e2b8a62e
commit
310af9a601
4 changed files with 29 additions and 37 deletions
|
@ -43,17 +43,17 @@ public class PmdOperationBuild extends Project {
|
|||
autoDownloadPurge = true;
|
||||
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
|
||||
|
||||
var pmd = version(7, 0, 0, "rc3");
|
||||
var pmd = version(7, 0, 0, "rc4");
|
||||
scope(compile)
|
||||
.include(dependency("com.uwyn.rife2", "bld", version(1, 7, 2)))
|
||||
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd));
|
||||
scope(runtime)
|
||||
.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,9)));
|
||||
scope(test)
|
||||
.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"));
|
||||
.include(dependency("org.assertj", "assertj-core", version(3, 24, 2)));
|
||||
|
||||
javadocOperation()
|
||||
.javadocOptions()
|
||||
|
|
|
@ -24,6 +24,8 @@ import rife.bld.BaseProject;
|
|||
import rife.bld.operations.AbstractOperation;
|
||||
|
||||
import java.net.URI;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
|
@ -66,7 +68,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
|
|||
/**
|
||||
* The encoding.
|
||||
*/
|
||||
String encoding = "UTF-8";
|
||||
Charset encoding_ = StandardCharsets.UTF_8;
|
||||
/**
|
||||
* The fail on violation toggle.
|
||||
*/
|
||||
|
@ -204,7 +206,18 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
|
|||
* <p>The valid values are the standard character sets of {@link java.nio.charset.Charset Charset}.</p>
|
||||
*/
|
||||
public PmdOperation encoding(String encoding) {
|
||||
encoding = encoding;
|
||||
encoding_ = Charset.forName(encoding);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Specifies the character set encoding of the source code files. The default is
|
||||
* {@link StandardCharsets#UTF_8 UTF-8}.</p>
|
||||
*
|
||||
* <p>The valid values are the standard character sets of {@link java.nio.charset.Charset Charset}.</p>
|
||||
*/
|
||||
public PmdOperation encoding(Charset encoding) {
|
||||
encoding_ = encoding;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -331,7 +344,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
|
|||
config.setReportFormat(reportFormat_);
|
||||
config.setRuleSets(ruleSets_);
|
||||
config.setShowSuppressedViolations(showSuppressed_);
|
||||
config.setSourceEncoding(encoding);
|
||||
config.setSourceEncoding(encoding_);
|
||||
config.setSuppressMarker(suppressedMarker_);
|
||||
config.setThreads(threads_);
|
||||
|
||||
|
@ -372,9 +385,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
|
|||
v.getFileId().getAbsolutePath(),
|
||||
v.getBeginLine(),
|
||||
v.getRule().getName(),
|
||||
v.getRule().getExternalInfoUrl() //TODO bug in PMD?
|
||||
.replace("${pmd.website.baseurl}",
|
||||
"https://docs.pmd-code.org/pmd-doc-7.0.0-rc1"),
|
||||
v.getRule().getExternalInfoUrl(),
|
||||
v.getDescription()});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package rife.bld.extension;
|
||||
|
||||
import net.sourceforge.pmd.PMDConfiguration;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -74,9 +75,13 @@ class PmdOperationTest {
|
|||
|
||||
@Test
|
||||
void testEncoding() {
|
||||
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).encoding("UTF-16");
|
||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
||||
assertThat(config.getSourceEncoding()).isEqualTo(StandardCharsets.UTF_16);
|
||||
PmdOperation pmd = newPmdOperation().ruleSets(CATEGORY_FOO).encoding("UTF-16");
|
||||
PMDConfiguration config = pmd.initConfiguration(COMMAND_NAME);
|
||||
assertThat(config.getSourceEncoding()).isEqualTo(StandardCharsets.UTF_16).as("UTF-16");
|
||||
|
||||
pmd = pmd.encoding(StandardCharsets.ISO_8859_1);
|
||||
config = pmd.initConfiguration(COMMAND_NAME);
|
||||
assertThat(config.getSourceEncoding()).isEqualTo(StandardCharsets.ISO_8859_1).as("ISO_8859");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue