diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml
index d36f0136b5..cf45143cbf 100644
--- a/eo-maven-plugin/pom.xml
+++ b/eo-maven-plugin/pom.xml
@@ -212,6 +212,11 @@ SOFTWARE.
+
+ org.codehaus.plexus
+ plexus-utils
+ 3.5.1
+
ch.qos.reload4j
reload4j
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/Moja.java b/eo-maven-plugin/src/main/java/org/eolang/maven/Moja.java
index 4b09b80639..525a0cb07f 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/Moja.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/Moja.java
@@ -85,6 +85,7 @@ public Moja with(final String attr, final Object value) {
* @param mojo Another mojo
* @return Itself
*/
+ @SuppressWarnings("PMD.AvoidAccessibilityAlteration")
public Moja copy(final Object mojo) {
final Collection mine = new ListOf<>(
new Mapped<>(
@@ -157,6 +158,7 @@ private static Collection fields(final Class> cls) {
* can't be set to the Mojo, we can't just remove Logger.warn. On the other hand, we will
* see warnings all the time during unit testing, which can be an insignificant problem.
*/
+ @SuppressWarnings("PMD.AvoidAccessibilityAlteration")
private void initField(
final Class> clazz,
final AbstractMojo mojo,
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizationFolder.java b/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizationFolder.java
index 58c0f0559f..fa2a4d80f2 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizationFolder.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizationFolder.java
@@ -59,7 +59,7 @@ public enum OptimizationFolder {
*
* @return The attribute name.
*/
- String key() {
+ String getKey() {
return this.key;
}
}
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizationTask.java b/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizationTask.java
index dce33e0e8a..a195def139 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizationTask.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizationTask.java
@@ -123,9 +123,9 @@ public Scalar value(
private Path make(final XML xml, final Path file) throws IOException {
final String name = new XMLDocument(file).xpath("/program/@name").get(0);
final Place place = new Place(name);
- final Path dir = this.paths.get(OptimizationFolder.TARGET.key());
+ final Path dir = this.paths.get(OptimizationFolder.TARGET.getKey());
final Path target = place.make(
- dir.resolve(this.dirs.get(OptimizationFolder.TARGET.key())), TranspileMojo.EXT
+ dir.resolve(this.dirs.get(OptimizationFolder.TARGET.getKey())), TranspileMojo.EXT
);
new HmBase(dir).save(
xml.toString(),
@@ -153,8 +153,8 @@ private Optimization optimization(final ForeignTojo tojo, final Optimization com
res = new OptCached(
common,
this.paths.get(
- OptimizationFolder.CACHE.key()
- ).resolve(this.dirs.get(OptimizationFolder.CACHE.key())).resolve(tojo.hash()),
+ OptimizationFolder.CACHE.getKey()
+ ).resolve(this.dirs.get(OptimizationFolder.CACHE.getKey())).resolve(tojo.hash()),
this.source.apply(tojo)
);
} else {
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java
index c725d32227..b922520e91 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java
@@ -70,9 +70,10 @@ public final class OptimizeMojo extends SafeMojo {
* The map with directories of OptimizeMojo.
* @checkstyle DiamondOperatorCheck (10 lines)
*/
+ @SuppressWarnings("PMD.UseDiamondOperator")
private static final Map DIRECTORIES = new MapOf(
- new MapEntry<>(OptimizationFolder.TARGET.key(), OptimizeMojo.DIR),
- new MapEntry<>(OptimizationFolder.CACHE.key(), OptimizeMojo.OPTIMIZED)
+ new MapEntry<>(OptimizationFolder.TARGET.getKey(), OptimizeMojo.DIR),
+ new MapEntry<>(OptimizationFolder.CACHE.getKey(), OptimizeMojo.OPTIMIZED)
);
/**
@@ -96,8 +97,8 @@ public void exec() {
this.optimization(),
new OptimizationTask(
new MapOf(
- new MapEntry<>(OptimizationFolder.TARGET.key(), this.targetDir.toPath()),
- new MapEntry<>(OptimizationFolder.CACHE.key(), this.cache)
+ new MapEntry<>(OptimizationFolder.TARGET.getKey(), this.targetDir.toPath()),
+ new MapEntry<>(OptimizationFolder.CACHE.getKey(), this.cache)
),
OptimizeMojo.DIRECTORIES,
ForeignTojo::withOptimized,
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/ProbeMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/ProbeMojo.java
index 2eb39ee2bd..2bd735cc88 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/ProbeMojo.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/ProbeMojo.java
@@ -98,6 +98,7 @@ public final class ProbeMojo extends SafeMojo {
);
@Override
+ @SuppressWarnings("PMD.CognitiveComplexity")
public void exec() throws IOException {
if (this.hash == null) {
this.hash = new ChCached(
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java
index 6778bb09fd..cdd1a409d3 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java
@@ -259,6 +259,7 @@ abstract class SafeMojo extends AbstractMojo {
* @checkstyle CyclomaticComplexityCheck (70 lines)
*/
@Override
+ @SuppressWarnings("PMD.CognitiveComplexity")
public final void execute() throws MojoFailureException {
StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
if (this.skip) {
@@ -383,35 +384,36 @@ private static void closeTojos(final Closeable res) throws MojoFailureException
*/
private void exitError(final String msg, final Throwable exp)
throws MojoFailureException {
+ if (!this.unrollExitError) {
+ return;
+ }
final MojoFailureException out = new MojoFailureException(msg, exp);
- if (this.unrollExitError) {
- final List causes = SafeMojo.causes(exp);
- for (int pos = 0; pos < causes.size(); ++pos) {
- final String cause = causes.get(pos);
- if (cause == null) {
- causes.remove(pos);
- break;
- }
+ final List causes = SafeMojo.causes(exp);
+ for (int pos = 0; pos < causes.size(); ++pos) {
+ final String cause = causes.get(pos);
+ if (cause == null) {
+ causes.remove(pos);
+ break;
+ }
+ }
+ int idx = 0;
+ while (true) {
+ if (idx >= causes.size()) {
+ break;
}
- int idx = 0;
- while (true) {
- if (idx >= causes.size()) {
+ final String cause = causes.get(idx);
+ for (int later = idx + 1; later < causes.size(); ++later) {
+ final String another = causes.get(later);
+ if (another != null && cause.contains(another)) {
+ causes.remove(idx);
+ idx -= 1;
break;
}
- final String cause = causes.get(idx);
- for (int later = idx + 1; later < causes.size(); ++later) {
- final String another = causes.get(later);
- if (another != null && cause.contains(another)) {
- causes.remove(idx);
- idx -= 1;
- break;
- }
- }
- idx += 1;
- }
- for (final String cause : new LinkedHashSet<>(causes)) {
- Logger.error(this, cause);
}
+ idx += 1;
+ }
+ for (final String cause : new LinkedHashSet<>(causes)) {
+ Logger.error(this, cause);
}
throw out;
}
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/ShakeMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/ShakeMojo.java
index f82a719a2c..0c42739350 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/ShakeMojo.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/ShakeMojo.java
@@ -67,9 +67,10 @@ public final class ShakeMojo extends SafeMojo {
* The map with directories of ShakeMojo.
* @checkstyle DiamondOperatorCheck (10 lines)
*/
+ @SuppressWarnings("PMD.UseDiamondOperator")
private static final Map DIRECTORIES = new MapOf(
- new MapEntry<>(OptimizationFolder.TARGET.key(), ShakeMojo.DIR),
- new MapEntry<>(OptimizationFolder.CACHE.key(), ShakeMojo.SHAKEN)
+ new MapEntry<>(OptimizationFolder.TARGET.getKey(), ShakeMojo.DIR),
+ new MapEntry<>(OptimizationFolder.CACHE.getKey(), ShakeMojo.SHAKEN)
);
/**
@@ -93,8 +94,8 @@ void exec() {
this.optimization(),
new OptimizationTask(
new MapOf(
- new MapEntry<>(OptimizationFolder.TARGET.key(), this.targetDir.toPath()),
- new MapEntry<>(OptimizationFolder.CACHE.key(), this.cache)
+ new MapEntry<>(OptimizationFolder.TARGET.getKey(), this.targetDir.toPath()),
+ new MapEntry<>(OptimizationFolder.CACHE.getKey(), this.cache)
),
ShakeMojo.DIRECTORIES,
ForeignTojo::withShaken,
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java
index 70df92939e..a21cf38159 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java
@@ -161,7 +161,7 @@ private static class Metas extends IterableEnvelope {
meta -> {
final String[] pair = meta.split(" ", 2);
final String head = pair[0].substring(1);
- if (head.equals(UnphiMojo.Metas.PACKAGE)) {
+ if (UnphiMojo.Metas.PACKAGE.equals(head)) {
throw new IllegalStateException(
"+package meta is prohibited for attaching to unphied XMIR"
);
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/UnplaceMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/UnplaceMojo.java
index 655539c1c6..89245c7a1a 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/UnplaceMojo.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/UnplaceMojo.java
@@ -75,6 +75,7 @@ public final class UnplaceMojo extends SafeMojo {
private Set keepBinaries = new SetOf<>();
@Override
+ @SuppressWarnings("PMD.AvoidAccessToStaticMembersViaThis")
public void exec() throws IOException {
if (this.placedTojos.isEmpty()) {
Logger.info(
@@ -105,6 +106,7 @@ private void unplaceJars() {
* Place what's necessary.
* @throws IOException If fails
*/
+ @SuppressWarnings("PMD.AvoidAccessToStaticMembersViaThis")
private void unplaceClasses() throws IOException {
final Collection classes = this.placedTojos.classes();
int deleted = 0;
@@ -141,6 +143,7 @@ private void unplaceClasses() throws IOException {
* @return Number of files deleted
* @throws IOException If fails
*/
+ @SuppressWarnings("PMD.CognitiveComplexity")
private int killThem(final Iterable all) throws IOException {
int unplaced = 0;
for (final PlacedTojo tojo : all) {
@@ -195,6 +198,7 @@ private int killThem(final Iterable all) throws IOException {
* @return Number of files deleted
* @throws IOException If fails
*/
+ @SuppressWarnings("PMD.AvoidAccessToStaticMembersViaThis")
private int keepThem(final Iterable extends PlacedTojo> tojos) throws IOException {
int deleted = 0;
int remained = 0;
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/VerifyMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/VerifyMojo.java
index a2489db470..82a5b34bfa 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/VerifyMojo.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/VerifyMojo.java
@@ -75,12 +75,12 @@ void exec() {
this.optimization(),
new OptimizationTask(
new MapOf(
- new MapEntry<>(OptimizationFolder.TARGET.key(), this.targetDir.toPath()),
- new MapEntry<>(OptimizationFolder.CACHE.key(), this.cache)
+ new MapEntry<>(OptimizationFolder.TARGET.getKey(), this.targetDir.toPath()),
+ new MapEntry<>(OptimizationFolder.CACHE.getKey(), this.cache)
),
new MapOf(
- new MapEntry<>(OptimizationFolder.TARGET.key(), "6-verify"),
- new MapEntry<>(OptimizationFolder.CACHE.key(), "verified")
+ new MapEntry<>(OptimizationFolder.TARGET.getKey(), "6-verify"),
+ new MapEntry<>(OptimizationFolder.CACHE.getKey(), "verified")
),
ForeignTojo::withVerified,
ForeignTojo::shaken
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChPattern.java b/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChPattern.java
index 022db96810..e09152d0f4 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChPattern.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChPattern.java
@@ -162,7 +162,7 @@ private int weight(final String tag) {
*/
private int numberOfConstants() {
return (int) Stream.of(this.template.split("\\."))
- .filter(s -> !s.equals("*")).count();
+ .filter(s -> !"*".equals(s)).count();
}
/**
@@ -173,7 +173,7 @@ private int numberOfConstants() {
private String regex() {
final List keys = new LinkedList<>();
for (final String key : this.template.split("\\.")) {
- if (key.equals("*")) {
+ if ("*".equals(key)) {
keys.add("\\w+");
} else {
keys.add(key);
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java
index 6f3ff256db..c70e8d2143 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojo.java
@@ -145,7 +145,7 @@ public String probed() {
public boolean notOptimized() {
final Path src = this.xmir();
boolean res = true;
- if (this.delegate.exists(ForeignTojos.Attribute.OPTIMIZED.key())) {
+ if (this.delegate.exists(ForeignTojos.Attribute.OPTIMIZED.getKey())) {
final Path tgt = this.optimized();
if (tgt.toFile().lastModified() >= src.toFile().lastModified()) {
Logger.debug(
@@ -165,7 +165,7 @@ public boolean notOptimized() {
public boolean notShaken() {
final Path src = this.optimized();
boolean res = true;
- if (this.delegate.exists(ForeignTojos.Attribute.SHAKEN.key())) {
+ if (this.delegate.exists(ForeignTojos.Attribute.SHAKEN.getKey())) {
final Path tgt = this.shaken();
if (tgt.toFile().lastModified() >= src.toFile().lastModified()) {
Logger.debug(
@@ -186,7 +186,7 @@ public boolean notShaken() {
public boolean notVerified() {
final Path src = this.xmir();
boolean res = true;
- if (this.delegate.exists(ForeignTojos.Attribute.VERIFIED.key())) {
+ if (this.delegate.exists(ForeignTojos.Attribute.VERIFIED.getKey())) {
final Path tgt = this.verified();
if (tgt.toFile().lastModified() >= src.toFile().lastModified()) {
Logger.debug(
@@ -206,7 +206,7 @@ public boolean notVerified() {
*/
public boolean notParsed() {
boolean res = true;
- if (this.delegate.exists(ForeignTojos.Attribute.XMIR.key())) {
+ if (this.delegate.exists(ForeignTojos.Attribute.XMIR.getKey())) {
final Path xmir = this.xmir();
if (xmir.toFile().lastModified() >= this.source().toFile().lastModified()) {
Logger.debug(
@@ -224,7 +224,7 @@ public boolean notParsed() {
* @return True if has hash, false otherwise.
*/
public boolean hasHash() {
- return this.delegate.exists(ForeignTojos.Attribute.HASH.key());
+ return this.delegate.exists(ForeignTojos.Attribute.HASH.getKey());
}
/**
@@ -233,7 +233,7 @@ public boolean hasHash() {
* @return The tojo itself.
*/
public ForeignTojo withJar(final Coordinates coordinates) {
- this.delegate.set(ForeignTojos.Attribute.JAR.key(), coordinates.toString());
+ this.delegate.set(ForeignTojos.Attribute.JAR.getKey(), coordinates.toString());
return this;
}
@@ -243,7 +243,7 @@ public ForeignTojo withJar(final Coordinates coordinates) {
* @return The tojo itself.
*/
public ForeignTojo withDiscovered(final int size) {
- this.delegate.set(ForeignTojos.Attribute.DISCOVERED.key(), Integer.valueOf(size));
+ this.delegate.set(ForeignTojos.Attribute.DISCOVERED.getKey(), Integer.valueOf(size));
return this;
}
@@ -253,10 +253,10 @@ public ForeignTojo withDiscovered(final int size) {
* @return The tojo itself.
*/
public ForeignTojo withDiscoveredAt(final Path path) {
- if (!this.delegate.exists(ForeignTojos.Attribute.VERSION.key())) {
- this.delegate.set(ForeignTojos.Attribute.VERSION.key(), "*.*.*");
+ if (!this.delegate.exists(ForeignTojos.Attribute.VERSION.getKey())) {
+ this.delegate.set(ForeignTojos.Attribute.VERSION.getKey(), "*.*.*");
}
- this.delegate.set(ForeignTojos.Attribute.DISCOVERED_AT.key(), path);
+ this.delegate.set(ForeignTojos.Attribute.DISCOVERED_AT.getKey(), path);
return this;
}
@@ -266,7 +266,7 @@ public ForeignTojo withDiscoveredAt(final Path path) {
* @return The tojo itself.
*/
public ForeignTojo withSodg(final Path sodg) {
- this.delegate.set(ForeignTojos.Attribute.SODG.key(), sodg.toString());
+ this.delegate.set(ForeignTojos.Attribute.SODG.getKey(), sodg.toString());
return this;
}
@@ -276,7 +276,7 @@ public ForeignTojo withSodg(final Path sodg) {
* @return The tojo itself.
*/
public ForeignTojo withOptimized(final Path xmir) {
- this.delegate.set(ForeignTojos.Attribute.OPTIMIZED.key(), xmir.toString());
+ this.delegate.set(ForeignTojos.Attribute.OPTIMIZED.getKey(), xmir.toString());
return this;
}
@@ -286,7 +286,7 @@ public ForeignTojo withOptimized(final Path xmir) {
* @return The tojo itself.
*/
public ForeignTojo withShaken(final Path xmir) {
- this.delegate.set(ForeignTojos.Attribute.SHAKEN.key(), xmir.toString());
+ this.delegate.set(ForeignTojos.Attribute.SHAKEN.getKey(), xmir.toString());
return this;
}
@@ -296,7 +296,7 @@ public ForeignTojo withShaken(final Path xmir) {
* @return The tojo itself.
*/
public ForeignTojo withVerified(final Path xmir) {
- this.delegate.set(ForeignTojos.Attribute.VERIFIED.key(), xmir.toString());
+ this.delegate.set(ForeignTojos.Attribute.VERIFIED.getKey(), xmir.toString());
return this;
}
@@ -306,7 +306,7 @@ public ForeignTojo withVerified(final Path xmir) {
* @return The tojo itself.
*/
public ForeignTojo withSource(final Path source) {
- this.delegate.set(ForeignTojos.Attribute.EO.key(), source.toString());
+ this.delegate.set(ForeignTojos.Attribute.EO.getKey(), source.toString());
return this;
}
@@ -316,7 +316,7 @@ public ForeignTojo withSource(final Path source) {
* @return The tojo itself.
*/
public ForeignTojo withHash(final CommitHash hash) {
- this.delegate.set(ForeignTojos.Attribute.HASH.key(), hash.value());
+ this.delegate.set(ForeignTojos.Attribute.HASH.getKey(), hash.value());
return this;
}
@@ -326,7 +326,7 @@ public ForeignTojo withHash(final CommitHash hash) {
* @return The tojo itself.
*/
public ForeignTojo withProbed(final int count) {
- this.delegate.set(ForeignTojos.Attribute.PROBED.key(), Integer.toString(count));
+ this.delegate.set(ForeignTojos.Attribute.PROBED.getKey(), Integer.toString(count));
return this;
}
@@ -336,7 +336,7 @@ public ForeignTojo withProbed(final int count) {
* @return The tojo itself.
*/
public ForeignTojo withXmir(final Path xmir) {
- this.delegate.set(ForeignTojos.Attribute.XMIR.key(), xmir.toString());
+ this.delegate.set(ForeignTojos.Attribute.XMIR.getKey(), xmir.toString());
return this;
}
@@ -346,7 +346,7 @@ public ForeignTojo withXmir(final Path xmir) {
* @return The tojo itself.
*/
public ForeignTojo withVersion(final String ver) {
- this.delegate.set(ForeignTojos.Attribute.VERSION.key(), ver);
+ this.delegate.set(ForeignTojos.Attribute.VERSION.getKey(), ver);
return this;
}
@@ -356,7 +356,7 @@ public ForeignTojo withVersion(final String ver) {
* @return The tojo itself.
*/
public ForeignTojo withScope(final String scope) {
- this.delegate.set(ForeignTojos.Attribute.SCOPE.key(), scope);
+ this.delegate.set(ForeignTojos.Attribute.SCOPE.getKey(), scope);
return this;
}
@@ -374,7 +374,7 @@ public String scope() {
* @return The tojo itself.
*/
public ForeignTojo withVer(final String ver) {
- this.delegate.set(ForeignTojos.Attribute.VER.key(), ver);
+ this.delegate.set(ForeignTojos.Attribute.VER.getKey(), ver);
return this;
}
@@ -411,7 +411,7 @@ public int hashCode() {
* @return The attribute.
*/
private String attribute(final ForeignTojos.Attribute attribute) {
- final String attr = this.delegate.get(attribute.key());
+ final String attr = this.delegate.get(attribute.getKey());
if (attr == null) {
throw new AttributeNotFoundException(attribute);
}
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java
index 92d269408a..6c26d46c4b 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java
@@ -110,8 +110,8 @@ public void close() throws IOException {
*/
public ForeignTojo add(final String name) {
final Tojo tojo = this.tojos.value().add(name);
- if (!tojo.exists(Attribute.SCOPE.key())) {
- tojo.set(Attribute.SCOPE.key(), this.scope.get());
+ if (!tojo.exists(Attribute.SCOPE.getKey())) {
+ tojo.set(Attribute.SCOPE.getKey(), this.scope.get());
}
return new ForeignTojo(tojo);
}
@@ -133,7 +133,7 @@ public ForeignTojo add(final ObjectName name) {
public ForeignTojo find(final String id) {
return new ForeignTojo(
this.tojos.value()
- .select(tojo -> tojo.get(Attribute.ID.key()).equals(id))
+ .select(tojo -> tojo.get(Attribute.ID.getKey()).equals(id))
.stream()
.findFirst()
.orElseThrow(
@@ -150,7 +150,9 @@ public ForeignTojo find(final String id) {
*/
public Collection notDiscovered() {
return this.select(
- row -> row.exists(Attribute.OPTIMIZED.key()) && !row.exists(Attribute.DISCOVERED.key())
+ row ->
+ row.exists(Attribute.OPTIMIZED.getKey())
+ && !row.exists(Attribute.DISCOVERED.getKey())
);
}
@@ -159,7 +161,7 @@ public Collection notDiscovered() {
* @return The tojos.
*/
public Collection withXmir() {
- return this.select(row -> row.exists(Attribute.XMIR.key()));
+ return this.select(row -> row.exists(Attribute.XMIR.getKey()));
}
/**
@@ -168,9 +170,9 @@ public Collection withXmir() {
*/
public Collection dependencies() {
return this.select(
- t -> t.exists(Attribute.XMIR.key())
- && t.exists(Attribute.VERSION.key())
- && !t.exists(Attribute.JAR.key())
+ t -> t.exists(Attribute.XMIR.getKey())
+ && t.exists(Attribute.VERSION.getKey())
+ && !t.exists(Attribute.JAR.getKey())
);
}
@@ -179,7 +181,7 @@ public Collection dependencies() {
* @return The tojos.
*/
public Collection withSources() {
- return this.select(row -> row.exists(Attribute.EO.key()));
+ return this.select(row -> row.exists(Attribute.EO.getKey()));
}
/**
@@ -188,8 +190,8 @@ public Collection withSources() {
*/
public Collection withoutSources() {
return this.select(
- row -> !row.exists(Attribute.EO.key())
- && !row.exists(Attribute.XMIR.key())
+ row -> !row.exists(Attribute.EO.getKey())
+ && !row.exists(Attribute.XMIR.getKey())
);
}
@@ -198,7 +200,7 @@ public Collection withoutSources() {
* @return The tojos.
*/
public Collection withOptimized() {
- return this.select(row -> row.exists(Attribute.OPTIMIZED.key()));
+ return this.select(row -> row.exists(Attribute.OPTIMIZED.getKey()));
}
/**
@@ -207,8 +209,8 @@ public Collection withOptimized() {
*/
public Collection unprobed() {
return this.select(
- row -> row.exists(Attribute.OPTIMIZED.key())
- && !row.exists(Attribute.PROBED.key())
+ row -> row.exists(Attribute.OPTIMIZED.getKey())
+ && !row.exists(Attribute.PROBED.getKey())
);
}
@@ -226,7 +228,7 @@ public Collection all() {
* @return True if the tojo exists.
*/
public boolean contains(final String name) {
- return !this.select(tojo -> tojo.get(Attribute.ID.key()).equals(name)).isEmpty();
+ return !this.select(tojo -> tojo.get(Attribute.ID.getKey()).equals(name)).isEmpty();
}
/**
@@ -264,7 +266,7 @@ public String status() {
String.format(
"%s:%d",
attr,
- this.select(tojo -> tojo.exists(attr.key())).size()
+ this.select(tojo -> tojo.exists(attr.getKey())).size()
)
);
}
@@ -277,7 +279,8 @@ public String status() {
* @return Selected tojos.
*/
private Collection select(final Predicate super Tojo> filter) {
- final Predicate scoped = t -> t.get(Attribute.SCOPE.key()).equals(this.scope.get());
+ final Predicate scoped = t ->
+ t.get(Attribute.SCOPE.getKey()).equals(this.scope.get());
return this.tojos.value()
.select(t -> filter.test(t) && scoped.test(t))
.stream().map(ForeignTojo::new).collect(Collectors.toList());
@@ -399,7 +402,7 @@ enum Attribute {
* Get the attribute name.
* @return The attribute name.
*/
- String key() {
+ String getKey() {
return this.key;
}
}
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/PlacedTojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/PlacedTojo.java
index 44ac064fd1..9e7e39f550 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/PlacedTojo.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/PlacedTojo.java
@@ -50,7 +50,7 @@ public final class PlacedTojo {
* @return The id.
*/
public String identifier() {
- return this.origin.get(PlacedTojos.Attribute.ID.key());
+ return this.origin.get(PlacedTojos.Attribute.ID.getKey());
}
/**
@@ -58,7 +58,7 @@ public String identifier() {
* @return The dependency.
*/
public String dependency() {
- return this.origin.get(PlacedTojos.Attribute.DEPENDENCY.key());
+ return this.origin.get(PlacedTojos.Attribute.DEPENDENCY.getKey());
}
/**
@@ -66,7 +66,7 @@ public String dependency() {
* @return The related file path.
*/
public String related() {
- return this.origin.get(PlacedTojos.Attribute.RELATED.key());
+ return this.origin.get(PlacedTojos.Attribute.RELATED.getKey());
}
/**
@@ -75,14 +75,14 @@ public String related() {
* @return True if the hash is the same.
*/
public boolean sameHash(final String hash) {
- return this.origin.get(PlacedTojos.Attribute.HASH.key()).equals(hash);
+ return this.origin.get(PlacedTojos.Attribute.HASH.getKey()).equals(hash);
}
/**
* Mark the tojo as unplaced.
*/
public void unplace() {
- this.origin.set(PlacedTojos.Attribute.UNPLACED.key(), "true");
+ this.origin.set(PlacedTojos.Attribute.UNPLACED.getKey(), "true");
}
/**
@@ -90,7 +90,7 @@ public void unplace() {
* @return True if the tojo is a class.
*/
public boolean isClass() {
- return "class".equals(this.origin.get(PlacedTojos.Attribute.KIND.key()));
+ return "class".equals(this.origin.get(PlacedTojos.Attribute.KIND.getKey()));
}
/**
@@ -98,7 +98,7 @@ public boolean isClass() {
* @return True if the tojo is a jar.
*/
public boolean isJar() {
- return "jar".equals(this.origin.get(PlacedTojos.Attribute.KIND.key()));
+ return "jar".equals(this.origin.get(PlacedTojos.Attribute.KIND.getKey()));
}
/**
@@ -114,7 +114,7 @@ public boolean placed() {
* @return True if the tojo is unplaced.
*/
public boolean unplaced() {
- return this.origin.exists(PlacedTojos.Attribute.UNPLACED.key())
- && "true".equals(this.origin.get(PlacedTojos.Attribute.UNPLACED.key()));
+ return this.origin.exists(PlacedTojos.Attribute.UNPLACED.getKey())
+ && "true".equals(this.origin.get(PlacedTojos.Attribute.UNPLACED.getKey()));
}
}
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/PlacedTojos.java b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/PlacedTojos.java
index 0d1b157c05..0594af0572 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/PlacedTojos.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/PlacedTojos.java
@@ -153,11 +153,11 @@ public PlacedTojo placeClass(
) {
return new PlacedTojo(
this.all.value().add(target.toString())
- .set(Attribute.KIND.key(), "class")
- .set(Attribute.HASH.key(), new FileHash(target))
- .set(Attribute.RELATED.key(), related)
- .set(Attribute.DEPENDENCY.key(), dep)
- .set(Attribute.UNPLACED.key(), "false")
+ .set(Attribute.KIND.getKey(), "class")
+ .set(Attribute.HASH.getKey(), new FileHash(target))
+ .set(Attribute.RELATED.getKey(), related)
+ .set(Attribute.DEPENDENCY.getKey(), dep)
+ .set(Attribute.UNPLACED.getKey(), "false")
);
}
@@ -167,9 +167,9 @@ public PlacedTojo placeClass(
*/
public void placeJar(final String name) {
this.all.value().add(name)
- .set(Attribute.KIND.key(), "jar")
- .set(Attribute.DEPENDENCY.key(), String.format("%s.jar", name))
- .set(Attribute.UNPLACED.key(), "false");
+ .set(Attribute.KIND.getKey(), "jar")
+ .set(Attribute.DEPENDENCY.getKey(), String.format("%s.jar", name))
+ .set(Attribute.UNPLACED.getKey(), "false");
}
/**
@@ -241,7 +241,7 @@ enum Attribute {
* Get attribute key.
* @return Key.
*/
- String key() {
+ String getKey() {
return this.key;
}
}
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/TranspiledTojos.java b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/TranspiledTojos.java
index 933cc81f47..c50717f6a5 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/TranspiledTojos.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/TranspiledTojos.java
@@ -88,7 +88,7 @@ public void close() throws IOException {
public void add(final Path transpiled, final Path optimized) {
synchronized (this.lock) {
this.all.value().add(String.valueOf(transpiled)).set(
- Attribute.OPTIMIZED.key(),
+ Attribute.OPTIMIZED.getKey(),
optimized
);
}
@@ -102,7 +102,7 @@ public void add(final Path transpiled, final Path optimized) {
public long remove(final Path optimized) {
return this.findByOptimized(optimized)
.stream()
- .map(row -> row.get(Attribute.ID.key()))
+ .map(row -> row.get(Attribute.ID.getKey()))
.map(File::new)
.filter(File::delete)
.count();
@@ -116,7 +116,7 @@ public long remove(final Path optimized) {
private List findByOptimized(final Path optimized) {
synchronized (this.lock) {
return this.all.value().select(
- row -> row.get(Attribute.OPTIMIZED.key()).equals(optimized.toString())
+ row -> row.get(Attribute.OPTIMIZED.getKey()).equals(optimized.toString())
);
}
}
@@ -155,7 +155,7 @@ private enum Attribute {
* Get attribute key.
* @return Attribute key.
*/
- String key() {
+ String getKey() {
return this.key;
}
}
diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/util/Walk.java b/eo-maven-plugin/src/main/java/org/eolang/maven/util/Walk.java
index 85fd7f58f1..10edd8e781 100644
--- a/eo-maven-plugin/src/main/java/org/eolang/maven/util/Walk.java
+++ b/eo-maven-plugin/src/main/java/org/eolang/maven/util/Walk.java
@@ -72,6 +72,7 @@ private Walk(final Path dir, final List list) {
* @param globs List of them
* @return New Walk
*/
+ @SuppressWarnings("PMD.AvoidAccessToStaticMembersViaThis")
public Walk includes(final Collection globs) {
return new Walk(
this.home,
@@ -90,6 +91,7 @@ public Walk includes(final Collection globs) {
* @param globs List of them
* @return New Walk
*/
+ @SuppressWarnings("PMD.AvoidAccessToStaticMembersViaThis")
public Walk excludes(final Collection globs) {
return new Walk(
this.home,
diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeMojoTest.java
index 61c91203a8..2d7e37af73 100644
--- a/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeMojoTest.java
+++ b/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeMojoTest.java
@@ -46,14 +46,14 @@
final class BinarizeMojoTest {
/**
- * Empty message for JUnit Assertions.
+ * Sources for the tests.
*/
- private static final String EMPTY_MSG = "EMPTY MESSAGE";
+ public static final Path SRC = Paths.get("src/test/resources/org/eolang/maven/binarize/");
/**
- * Sources for the tests.
+ * Empty message for JUnit Assertions.
*/
- public static final Path SRC = Paths.get("src/test/resources/org/eolang/maven/binarize/");
+ private static final String EMPTY_MSG = "EMPTY MESSAGE";
/**
* BinarizeMojo can binarize without errors.
diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/SodgMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/SodgMojoTest.java
index bf56b96890..4f722f4ec3 100644
--- a/eo-maven-plugin/src/test/java/org/eolang/maven/SodgMojoTest.java
+++ b/eo-maven-plugin/src/test/java/org/eolang/maven/SodgMojoTest.java
@@ -45,7 +45,6 @@
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
@@ -89,12 +88,16 @@ void transformsThroughSheets(final String yaml) {
@ParameterizedTest
@ClasspathSource(value = "org/eolang/maven/sodgs/", glob = "**.yaml")
- @SuppressWarnings("PMD.JUnitTestContainsTooManyAsserts")
+ @SuppressWarnings({
+ "PMD.JUnitTestContainsTooManyAsserts",
+ "PMD.ProhibitPlainJunitAssertionsRule"
+ })
void generatesSodgForPacks(final String pack) throws Exception {
final Map map = new Yaml().load(pack);
- Assumptions.assumeTrue(
- map.get("skip") == null,
- String.format("%s is skipped", pack)
+ MatcherAssert.assertThat(
+ String.format("%s is skipped", pack),
+ map.get("skip"),
+ Matchers.equalTo(null)
);
Object inclusion = map.get("inclusion");
if (inclusion == null) {
@@ -196,7 +199,11 @@ public boolean matchesSafely(final String item) {
* @checkstyle CyclomaticComplexityCheck (10 lines)
* @checkstyle NPathComplexityCheck (10 lines)
*/
- @SuppressWarnings({"PMD.NPathComplexity", "PMD.ExcessiveMethodLength"})
+ @SuppressWarnings({
+ "PMD.NPathComplexity",
+ "PMD.ExcessiveMethodLength",
+ "PMD.CognitiveComplexity"
+ })
private void matches(final String item) {
String vertex = "ν0";
final String[] parts = item.split(" ");
diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java
index e795dee98f..9ac19577e6 100644
--- a/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java
+++ b/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java
@@ -290,7 +290,7 @@ private String createRegEx(final Path path, final String error) {
.replace("\\", "\\\\")
);
final String res;
- if (error.equals("Warnings identified")) {
+ if ("Warnings identified".equals(error)) {
res = str.concat(", \\d*: .*[\\s]*)+\\]");
} else {
res = str.concat(", \\d+: .*[\\s]*)+\\]");
diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackTest.java
index ee4dde5977..8687cc75e0 100644
--- a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackTest.java
+++ b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackTest.java
@@ -39,7 +39,7 @@
* @since 1.0
*/
final class OyFallbackTest {
-
+
/**
* Empty message for JUnit Assertions.
*/
diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java
index f01467d837..eb44ca6568 100644
--- a/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java
+++ b/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java
@@ -44,6 +44,7 @@
*
* @since 0.29.5
*/
+@SuppressWarnings("PMD.TooManyMethods")
final class ForeignTojosTest {
/**
diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmBaseTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmBaseTest.java
index 58dd3942ac..227807d496 100644
--- a/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmBaseTest.java
+++ b/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmBaseTest.java
@@ -46,7 +46,7 @@
* @since 0.22
*/
final class HmBaseTest {
-
+
/**
* Empty message for JUnit Assertions.
*/