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