Compare commits
5 commits
d20f3e41b8
...
f46d75c2fe
Author | SHA1 | Date | |
---|---|---|---|
f46d75c2fe | |||
592c0c514d | |||
3b0550add2 | |||
22b7ab9220 | |||
a986add8ee |
2 changed files with 29 additions and 27 deletions
|
@ -31,23 +31,24 @@ public class PmdOperationBuild extends Project {
|
|||
public PmdOperationBuild() {
|
||||
pkg = "rife.bld.extension";
|
||||
name = "bld-pmd";
|
||||
version = version(1, 1, 5);
|
||||
version = version(1, 1, 6);
|
||||
|
||||
javaRelease = 17;
|
||||
|
||||
downloadSources = true;
|
||||
autoDownloadPurge = true;
|
||||
|
||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
|
||||
|
||||
var pmd = version(7, 5, 0);
|
||||
var pmd = version(7, 6, 0);
|
||||
scope(compile)
|
||||
.include(dependency("com.uwyn.rife2", "bld", version(2, 1, 0)))
|
||||
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd));
|
||||
scope(runtime)
|
||||
.include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 16)));
|
||||
scope(test)
|
||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0)))
|
||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0)))
|
||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 1)))
|
||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 1)))
|
||||
.include(dependency("org.assertj", "assertj-core", version(3, 26, 3)));
|
||||
|
||||
javadocOperation()
|
||||
|
@ -59,29 +60,26 @@ public class PmdOperationBuild extends Project {
|
|||
.link("https://javadoc.io/doc/net.sourceforge.pmd/pmd-core/latest/");
|
||||
|
||||
publishOperation()
|
||||
// .repository(MAVEN_LOCAL)
|
||||
.repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
|
||||
.repository(repository("github"))
|
||||
.info()
|
||||
.groupId("com.uwyn.rife2")
|
||||
.artifactId("bld-pmd")
|
||||
.description("bld Extension to Perform Static Code Analysis with PMD")
|
||||
.url("https://github.com/rife2/bld-pmd")
|
||||
.developer(
|
||||
new PublishDeveloper()
|
||||
.id("ethauvin").name("Erik C. Thauvin")
|
||||
.email("erik@thauvin.net")
|
||||
.url("https://erik.thauvin.net/")
|
||||
.developer(new PublishDeveloper()
|
||||
.id("ethauvin").name("Erik C. Thauvin")
|
||||
.email("erik@thauvin.net")
|
||||
.url("https://erik.thauvin.net/")
|
||||
)
|
||||
.license(
|
||||
new PublishLicense()
|
||||
.name("The Apache License, Version 2.0")
|
||||
.url("https://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||
.license(new PublishLicense()
|
||||
.name("The Apache License, Version 2.0")
|
||||
.url("https://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||
)
|
||||
.scm(
|
||||
new PublishScm()
|
||||
.connection("scm:git:https://github.com/rife2/bld-pmd.git")
|
||||
.developerConnection("scm:git:git@github.com:rife2/bld-pmd.git")
|
||||
.url("https://github.com/rife2/bld-pmd")
|
||||
.scm(new PublishScm()
|
||||
.connection("scm:git:https://github.com/rife2/bld-pmd.git")
|
||||
.developerConnection("scm:git:git@github.com:rife2/bld-pmd.git")
|
||||
.url("https://github.com/rife2/bld-pmd")
|
||||
)
|
||||
.signKey(property("sign.key"))
|
||||
.signPassphrase(property("sign.passphrase"));
|
||||
|
|
|
@ -19,6 +19,7 @@ package rife.bld.extension;
|
|||
import net.sourceforge.pmd.PMDConfiguration;
|
||||
import net.sourceforge.pmd.lang.LanguageRegistry;
|
||||
import net.sourceforge.pmd.lang.rule.RulePriority;
|
||||
import org.assertj.core.api.AutoCloseableSoftAssertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import rife.bld.BaseProject;
|
||||
import rife.bld.operations.exceptions.ExitStatusException;
|
||||
|
@ -382,20 +383,20 @@ class PmdOperationTest {
|
|||
var pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO)).relativizeRoots(foo).relativizeRoots(bar.toFile())
|
||||
.relativizeRoots(baz.toString()).relativizeRoots(List.of(foo, bar, baz));
|
||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
||||
assertThat(config.getRelativizeRoots()).isEqualTo(pmd.relativizeRoots());
|
||||
assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz, foo, bar, baz);
|
||||
assertThat(config.getRelativizeRoots()).isEqualTo(pmd.relativizeRoots())
|
||||
.containsExactly(foo, bar, baz, foo, bar, baz);
|
||||
|
||||
pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO))
|
||||
.relativizeRootsFiles(List.of(foo.toFile(), bar.toFile(), baz.toFile()));
|
||||
config = pmd.initConfiguration(COMMAND_NAME);
|
||||
assertThat(config.getRelativizeRoots()).as("List(File...)").isEqualTo(pmd.relativizeRoots());
|
||||
assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz);
|
||||
assertThat(config.getRelativizeRoots()).as("List(File...)").isEqualTo(pmd.relativizeRoots())
|
||||
.containsExactly(foo, bar, baz);
|
||||
|
||||
pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO))
|
||||
.relativizeRootsStrings(List.of(foo.toString(), bar.toString(), baz.toString()));
|
||||
config = pmd.initConfiguration(COMMAND_NAME);
|
||||
assertThat(config.getRelativizeRoots()).as("List(String....)").isEqualTo(pmd.relativizeRoots());
|
||||
assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz);
|
||||
assertThat(config.getRelativizeRoots()).as("List(String....)").isEqualTo(pmd.relativizeRoots())
|
||||
.containsExactly(foo, bar, baz);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -419,8 +420,11 @@ class PmdOperationTest {
|
|||
void testReportFormat() throws IOException, ExitStatusException {
|
||||
var pmd = newPmdOperation().ruleSets(ERROR_PRONE_XML).reportFormat("xml").inputPaths(ERROR_PRONE_SAMPLE);
|
||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
||||
try (var br = Files.newBufferedReader(pmd.reportFile())) {
|
||||
assertThat(br.readLine()).as("xml report").startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
try (var softly = new AutoCloseableSoftAssertions()) {
|
||||
try (var br = Files.newBufferedReader(pmd.reportFile())) {
|
||||
softly.assertThat(br.readLine()).as("xml report")
|
||||
.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue