Upgraded to PMD 7.0.0-rc1
This commit is contained in:
parent
d5ab8b6518
commit
93b466a338
10 changed files with 30 additions and 22 deletions
2
.idea/codeStyles/codeStyleConfig.xml
generated
2
.idea/codeStyles/codeStyleConfig.xml
generated
|
@ -1,5 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
||||
</state>
|
||||
</component>
|
4
.idea/libraries/bld.xml
generated
4
.idea/libraries/bld.xml
generated
|
@ -2,11 +2,11 @@
|
|||
<library name="bld">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.20.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.22.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.20-sources.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.22-sources.jar!/" />
|
||||
</SOURCES>
|
||||
<excluded>
|
||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
||||
|
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -7,7 +7,7 @@
|
|||
],
|
||||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.project.referencedLibraries": [
|
||||
"${HOME}/.rife2/dist/rife2-1.5.20.jar",
|
||||
"${HOME}/.rife2/dist/rife2-1.5.22.jar",
|
||||
"lib/compile/*.jar",
|
||||
"lib/runtime/*.jar",
|
||||
"lib/test/*.jar"
|
||||
|
|
Binary file not shown.
|
@ -3,4 +3,4 @@ bld.downloadExtensionSources=true
|
|||
bld.extensions=
|
||||
bld.repositories=MAVEN_CENTRAL,RIFE2
|
||||
rife2.downloadLocation=
|
||||
rife2.version=1.5.20
|
||||
rife2.version=1.5.22
|
||||
|
|
|
@ -7,8 +7,11 @@ import rife.bld.publish.PublishScm;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static rife.bld.dependencies.Repository.*;
|
||||
import static rife.bld.dependencies.Scope.*;
|
||||
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
||||
import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
|
||||
import static rife.bld.dependencies.Scope.compile;
|
||||
import static rife.bld.dependencies.Scope.runtime;
|
||||
import static rife.bld.dependencies.Scope.test;
|
||||
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
||||
|
||||
|
||||
|
@ -23,11 +26,12 @@ public class PmdOperationBuild extends Project {
|
|||
autoDownloadPurge = true;
|
||||
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
|
||||
|
||||
var pmd = version(7, 0, 0, "rc1");
|
||||
scope(compile)
|
||||
.include(dependency("com.uwyn.rife2", "rife2", version(1, 5, 20)))
|
||||
.include(dependency("net.sourceforge.pmd:pmd-java:6.55.0"));
|
||||
.include(dependency("com.uwyn.rife2", "rife2", version(1, 5, 22)))
|
||||
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd));
|
||||
scope(runtime)
|
||||
.include(dependency("net.sourceforge.pmd:pmd:6.55.0"));
|
||||
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd));
|
||||
scope(test)
|
||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 2)))
|
||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 2)))
|
||||
|
|
|
@ -353,7 +353,8 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
|
|||
var pmd = PmdAnalysis.create(config);
|
||||
var report = pmd.performAnalysisAndCollectReport();
|
||||
if (LOGGER.isLoggable(Level.INFO)) {
|
||||
LOGGER.info(String.format("[%s] ruleSets%s", commandName, ruleSets));
|
||||
LOGGER.log(Level.INFO, "[{0}] inputPaths{1}", new Object[]{commandName, inputPaths});
|
||||
LOGGER.log(Level.INFO, "[{0}] ruleSets{1}", new Object[]{commandName, ruleSets});
|
||||
}
|
||||
var numErrors = report.getViolations().size();
|
||||
if (numErrors > 0) {
|
||||
|
@ -362,11 +363,11 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
|
|||
config.getReportFilePath().toUri());
|
||||
for (var v : report.getViolations()) {
|
||||
if (LOGGER.isLoggable(Level.WARNING)) {
|
||||
LOGGER.warning(String.format("[%s] %s:%d:\n\t%s (%s)\n\t\t--> %s", commandName,
|
||||
Paths.get(v.getFilename()).toUri(), v.getBeginLine(), v.getRule().getName(),
|
||||
v.getRule().getExternalInfoUrl() //TODO bug in PMD?
|
||||
.replace("${pmd.website.baseurl}", "https://docs.pmd-code.org/pmd-doc-6.55.0"),
|
||||
v.getDescription()));
|
||||
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(),
|
||||
v.getRule().getName(),
|
||||
v.getRule().getExternalInfoUrl(),
|
||||
v.getDescription()});
|
||||
}
|
||||
}
|
||||
if (config.isFailOnViolation()) {
|
||||
|
|
|
@ -39,7 +39,7 @@ class PmdOperationTest {
|
|||
static final String CATEGORY_FOO = "category/foo.xml";
|
||||
static final String CODE_STYLE = "category/java/codestyle.xml";
|
||||
static final Path CODE_STYLE_SAMPLE = Path.of("src/test/resources/java/CodeStyle.java");
|
||||
static final int CODING_STYLE_ERRORS = 16;
|
||||
static final int CODING_STYLE_ERRORS = 13;
|
||||
static final String COMMAND_NAME = "pmd";
|
||||
static final String ERROR_PRONE = "category/java/errorprone.xml";
|
||||
static final int ERROR_PRONE_ERRORS = 8;
|
||||
|
@ -59,7 +59,7 @@ class PmdOperationTest {
|
|||
void testAddInputPaths() {
|
||||
var pmd = newPmdOperation().ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE).inputPaths(ERROR_PRONE_SAMPLE)
|
||||
.addInputPath(CODE_STYLE_SAMPLE);
|
||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(42);
|
||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(36);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -128,7 +128,7 @@ class PmdOperationTest {
|
|||
.as("code style").isEqualTo(CODING_STYLE_ERRORS);
|
||||
pmd = pmd.addRuleSet(ERROR_PRONE).addInputPath(ERROR_PRONE_SAMPLE);
|
||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
||||
.as("code style + error prone").isEqualTo(40);
|
||||
.as("code style + error prone").isEqualTo(34);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -156,7 +156,7 @@ class PmdOperationTest {
|
|||
void testJavaMultiThreading() {
|
||||
var pmd = newPmdOperation().ruleSets("category/java/multithreading.xml")
|
||||
.inputPaths(Path.of("src/test/resources/java/MultiThreading.java"));
|
||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(4);
|
||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -170,7 +170,7 @@ class PmdOperationTest {
|
|||
void testJavaQuickStart() {
|
||||
var pmd = newPmdOperation().ruleSets("rulesets/java/quickstart.xml")
|
||||
.inputPaths(Path.of("src/test/resources/java"));
|
||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(35);
|
||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(34);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
src/test/resources/java/
|
||||
src/main
|
||||
src/test
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package java;
|
||||
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
/**
|
||||
* Security class
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue