From e4867134d9838abd2fa1c7588fb2ab9b09faec87 Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Fri, 7 Feb 2025 17:53:34 +0300 Subject: [PATCH 1/2] bug(#3869): fixin --- .../main/java/org/eolang/maven/LintMojo.java | 32 +++++++++++++------ .../main/java/org/eolang/maven/PhiMojo.java | 2 +- .../java/org/eolang/maven/RegisterMojo.java | 24 -------------- .../eolang/maven/RandomProgramResolver.java | 1 - .../test/resources/org/eolang/maven/mess.eo | 6 ---- eo-runtime/pom.xml | 4 ++- eo-runtime/src/main/eo/org/eolang/math/e.eo | 1 + eo-runtime/src/main/eo/org/eolang/txt/text.eo | 4 --- 8 files changed, 27 insertions(+), 47 deletions(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java index 96c4c73347..5925cce72f 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java @@ -78,13 +78,18 @@ public final class LintMojo extends SafeMojo { * @checkstyle MemberNameCheck (11 lines) */ @SuppressWarnings("PMD.ImmutableField") - @Parameter( - property = "eo.failOnWarning", - required = true, - defaultValue = "true" - ) + @Parameter(property = "eo.failOnWarning", required = true, defaultValue = "true") private boolean failOnWarning; + /** + * Whether we should lint all the sources together as package. + * + * @checkstyle MemberNameCheck (11 lines) + */ + @SuppressWarnings("PMD.ImmutableField") + @Parameter(property = "eo.lintAsPackage", required = true, defaultValue = "true") + private boolean lintAsPackage; + @Override void exec() throws IOException { final long start = System.currentTimeMillis(); @@ -100,11 +105,18 @@ void exec() throws IOException { if (tojos.isEmpty()) { Logger.info(this, "There are no XMIR programs, nothing to lint individually"); } - Logger.info( - this, - "Also, %d XMIR programs linted as a package", - this.lintAll(counts) - ); + if (this.lintAsPackage) { + Logger.info( + this, + "XMIR programs linted as a package: %d", + this.lintAll(counts) + ); + } else { + Logger.info( + this, + "Skipping linting as package (use -Deo.lintAsPackage=true to enable)" + ); + } final String sum = LintMojo.summary(counts); Logger.info( this, diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java index bd53198620..bead4e1843 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java @@ -147,7 +147,7 @@ private int translate(final Path xmir, final int position, final int total) final XML xml = new XMLDocument(new TextOf(xmir).asString()); try { new Saved(this.translated(xml), target).value(); - Logger.info( + Logger.debug( this, "Translated to phi (#%d/%d): %[file]s (%[size]s) -> %[file]s (%[size]s) in %[ms]s", position, total, xmir, diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java index bf967e3a5a..a48d9b5b7b 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java @@ -47,30 +47,6 @@ ) @SuppressWarnings("PMD.ImmutableField") public final class RegisterMojo extends SafeMojo { - - /** - * Directory in which {@code .eo} files are located. - * - *

If you need to register {@code .eo} files located in many directories, - * you can use the {@code <includeSources>} feature, for example:

- * - *
 <configuration>
-     *   <sourcesDir>/</sourcesDir>
-     *   <includeSources>
-     *     <glob>tmp/**/*.eo</glob>
-     *     <glob>src/main/**/*.eo</glob>
-     *   </includeSources>
-     * </configuration>
- * - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter( - property = "eo.sourcesDir", - required = true, - defaultValue = "${project.basedir}/src/main/eo" - ) - private File sourcesDir; - /** * List of inclusion GLOB filters for finding EO files * in the {@code } directory, which can be diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/RandomProgramResolver.java b/eo-maven-plugin/src/test/java/org/eolang/maven/RandomProgramResolver.java index aeb2d3a909..8c506b955d 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/RandomProgramResolver.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/RandomProgramResolver.java @@ -48,7 +48,6 @@ public Object resolveParameter(final ParameterContext context, final ExtensionContext ext) { return String.join( "\n", - "+unlint object-has-data\n", "# This is a random program in EO, which supposedly", "# complies with all syntactic rules of the language,", "# include the requirements for comments.", diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo b/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo index 70cb8a621b..a7cb8ce5a7 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo @@ -27,12 +27,6 @@ +tests +package org.eolang.examples +version 0.0.0 -+unlint atom-is-not-unique -+unlint broken-ref -+unlint incorrect-alias -+unlint object-is-not-unique -+unlint broken-alias-second -+unlint object-has-data 3.14 > pi diff --git a/eo-runtime/pom.xml b/eo-runtime/pom.xml index 5998626739..5ef592a197 100644 --- a/eo-runtime/pom.xml +++ b/eo-runtime/pom.xml @@ -245,6 +245,7 @@ SOFTWARE. false true + false @@ -252,7 +253,8 @@ SOFTWARE. generate-test-sources register - compile + assemble + lint xmir-to-phi phi-to-xmir transpile diff --git a/eo-runtime/src/main/eo/org/eolang/math/e.eo b/eo-runtime/src/main/eo/org/eolang/math/e.eo index 3e547e9869..d5dd4e6bcd 100644 --- a/eo-runtime/src/main/eo/org/eolang/math/e.eo +++ b/eo-runtime/src/main/eo/org/eolang/math/e.eo @@ -24,6 +24,7 @@ +home https://github.com/objectionary/eo +package org.eolang.math +version 0.0.0 ++unlint unit-test-missing # The Euler's number. # A fundamental mathematical constant approximately equal to 2.7182818284590452354. diff --git a/eo-runtime/src/main/eo/org/eolang/txt/text.eo b/eo-runtime/src/main/eo/org/eolang/txt/text.eo index c375b94a28..41675b8dd0 100644 --- a/eo-runtime/src/main/eo/org/eolang/txt/text.eo +++ b/eo-runtime/src/main/eo/org/eolang/txt/text.eo @@ -32,10 +32,6 @@ # Text. # A sequence of characters representing words, sentences, or data. -# @todo #3481:30min Remove all +unlit metas from EO source code. -# These suppressions were added in order to be compile EO when @ref attribute -# from XMIR is removed, by it's checked by LintMojo. We need to remove these -# suppressions when `lints` repository is fixed and new version is used in EO. [origin] > text origin > @ # Check that all signs in string are numbers or letters. From b3013b80b2cbbb752b728cd60987ef6825c6db27 Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Fri, 7 Feb 2025 17:58:35 +0300 Subject: [PATCH 2/2] bug(#3869): qulice --- eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java | 1 - 1 file changed, 1 deletion(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java index a48d9b5b7b..ebb18cdb84 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java @@ -24,7 +24,6 @@ package org.eolang.maven; import com.jcabi.log.Logger; -import java.io.File; import java.nio.file.Path; import java.util.Collection; import java.util.Set;