Compare commits

..

No commits in common. "9d301b5ef6b7d1d45f045cd25efd77f2256a86be" and "18576d27bae1ecf1c5957f99283c387d758af3ea" have entirely different histories.

5 changed files with 27 additions and 40 deletions

16
.vscode/launch.json vendored
View file

@ -1,11 +1,23 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Run Main",
"request": "launch",
"mainClass": "rife.bld.extension.PmdOperation },
{
"type": "java",
"name": "Run Tests",
"request": "launch",
"mainClass": "rife.bld.extension.PmdOperationTest"
"mainClass": "org.junit.platform.console.ConsoleLauncher",
"args": [
"--details=verbose",
"--scan-classpath",
"--disable-banner",
"--disable-ansi-colors",
"--exclude-engine=junit-platform-suite",
"--exclude-engine=junit-vintage"]
}
]
}
}

View file

@ -7,10 +7,8 @@
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-1.8.0.jar",
"lib/bld/*.jar",
"${HOME}bld-1.7.0-SNAPSHOT.jar",
"lib/compile/*.jar",
"lib/provided/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]

Binary file not shown.

View file

@ -34,7 +34,7 @@ public class PmdOperationBuild extends Project {
public PmdOperationBuild() {
pkg = "rife.bld.extension";
name = "bld-pmd";
version = version(0, 9, 6);
version = version(0, 9, 5);
javaRelease = 17;
downloadSources = true;
@ -47,11 +47,11 @@ public class PmdOperationBuild extends Project {
.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, 12)));
.include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 11)));
scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2)))
.include(dependency("org.assertj", "assertj-core", version(3, 25, 3)));
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1)))
.include(dependency("org.assertj", "assertj-core", version(3, 25, 2)));
javadocOperation()
.javadocOptions()

View file

@ -81,10 +81,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* The path of the ignore file
*/
Path ignoreFile_;
/**
* The include line number toggle.
*/
boolean includeLineNumber_ = true;
/**
* The incremental analysis toggle.
*/
@ -304,18 +300,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this;
}
/**
* Enables or disables including the line number for the beginning of the violation in the analyzed source file URI.
* <p>
* While clicking on the URI works in IntelliJ IDEA, Visual Studio Code, etc.; it might not in terminal emulators.
* <p>
* Default: {@code TRUE}
*/
public PmdOperation includeLineNumber(boolean includeLineNumber) {
includeLineNumber_ = includeLineNumber;
return this;
}
/**
* Enables or disables incremental analysis.
*/
@ -415,17 +399,14 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
}
var numErrors = report.getViolations().size();
if (numErrors > 0) {
var msg = String.format(
"[%s] %d rule violations were found. See the report at: %s", commandName, numErrors,
config.getReportFilePath().toUri());
for (var v : report.getViolations()) {
if (LOGGER.isLoggable(Level.WARNING)) {
final String msg;
if (includeLineNumber_) {
msg = "[{0}] {1}:{2}\n\t{3} ({4})\n\t\t--> {5}";
} else {
msg = "\"[{0}] {1} (line: {2})\\n\\t{3} ({4})\\n\\t\\t--> {5}\"";
}
LOGGER.log(Level.WARNING, msg,
LOGGER.log(Level.WARNING, "[{0}] {1}:{2}:\n\t{3} ({4})\n\t\t--> {5}",
new Object[]{commandName,
v.getFileId().getUriString(),
v.getFileId().getAbsolutePath(),
v.getBeginLine(),
v.getRule().getName(),
v.getRule().getExternalInfoUrl() //TODO bug in PMD?
@ -434,15 +415,11 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
v.getDescription()});
}
}
var violations = String.format(
"[%s] %d rule violations were found. See the report at: %s", commandName, numErrors,
config.getReportFilePath().toUri());
if (config.isFailOnViolation()) {
throw new RuntimeException(violations); // NOPMD
throw new RuntimeException(msg); // NOPMD
} else {
if (LOGGER.isLoggable(Level.WARNING)) {
LOGGER.warning(violations);
LOGGER.warning(msg);
}
}
} else {