Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(#3869): added boolean flag for linting as package #3898

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
25 changes: 0 additions & 25 deletions eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -47,30 +46,6 @@
)
@SuppressWarnings("PMD.ImmutableField")
public final class RegisterMojo extends SafeMojo {

/**
* Directory in which {@code .eo} files are located.
*
* <p>If you need to register {@code .eo} files located in many directories,
* you can use the {@code &lt;includeSources&gt;} feature, for example:</p>
*
* <pre> &lt;configuration&gt;
* &lt;sourcesDir&gt;/&lt;/sourcesDir&gt;
* &lt;includeSources&gt;
* &lt;glob&gt;tmp/&#42;&#42;/&#42;.eo&lt;/glob&gt;
* &lt;glob&gt;src/main/&#42;&#42;/&#42;.eo&lt;/glob&gt;
* &lt;/includeSources&gt;
* &lt;/configuration&gt;</pre>
*
* @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 <includeSources>} directory, which can be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
6 changes: 0 additions & 6 deletions eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion eo-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,16 @@ SOFTWARE.
<configuration>
<withRuntimeDependency>false</withRuntimeDependency>
<placeBinariesThatHaveSources>true</placeBinariesThatHaveSources>
<lintAsPackage>false</lintAsPackage>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<phase>generate-test-sources</phase>
<goals>
<goal>register</goal>
<goal>compile</goal>
<goal>assemble</goal>
<goal>lint</goal>
<goal>xmir-to-phi</goal>
<goal>phi-to-xmir</goal>
<goal>transpile</goal>
Expand Down
1 change: 1 addition & 0 deletions eo-runtime/src/main/eo/org/eolang/math/e.eo
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions eo-runtime/src/main/eo/org/eolang/txt/text.eo
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading