Skip to content

Commit b4151e7

Browse files
authored
Merge pull request #3898 from maxonfjvipon/bug/#3869/fix-linting
bug(#3869): added boolean flag for linting as package
2 parents a828139 + b3013b8 commit b4151e7

8 files changed

Lines changed: 27 additions & 48 deletions

File tree

eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,18 @@ public final class LintMojo extends SafeMojo {
7878
* @checkstyle MemberNameCheck (11 lines)
7979
*/
8080
@SuppressWarnings("PMD.ImmutableField")
81-
@Parameter(
82-
property = "eo.failOnWarning",
83-
required = true,
84-
defaultValue = "true"
85-
)
81+
@Parameter(property = "eo.failOnWarning", required = true, defaultValue = "true")
8682
private boolean failOnWarning;
8783

84+
/**
85+
* Whether we should lint all the sources together as package.
86+
*
87+
* @checkstyle MemberNameCheck (11 lines)
88+
*/
89+
@SuppressWarnings("PMD.ImmutableField")
90+
@Parameter(property = "eo.lintAsPackage", required = true, defaultValue = "true")
91+
private boolean lintAsPackage;
92+
8893
@Override
8994
void exec() throws IOException {
9095
final long start = System.currentTimeMillis();
@@ -100,11 +105,18 @@ void exec() throws IOException {
100105
if (tojos.isEmpty()) {
101106
Logger.info(this, "There are no XMIR programs, nothing to lint individually");
102107
}
103-
Logger.info(
104-
this,
105-
"Also, %d XMIR programs linted as a package",
106-
this.lintAll(counts)
107-
);
108+
if (this.lintAsPackage) {
109+
Logger.info(
110+
this,
111+
"XMIR programs linted as a package: %d",
112+
this.lintAll(counts)
113+
);
114+
} else {
115+
Logger.info(
116+
this,
117+
"Skipping linting as package (use -Deo.lintAsPackage=true to enable)"
118+
);
119+
}
108120
final String sum = LintMojo.summary(counts);
109121
Logger.info(
110122
this,

eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private int translate(final Path xmir, final int position, final int total)
147147
final XML xml = new XMLDocument(new TextOf(xmir).asString());
148148
try {
149149
new Saved(this.translated(xml), target).value();
150-
Logger.info(
150+
Logger.debug(
151151
this,
152152
"Translated to phi (#%d/%d): %[file]s (%[size]s) -> %[file]s (%[size]s) in %[ms]s",
153153
position, total, xmir,

eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
package org.eolang.maven;
2525

2626
import com.jcabi.log.Logger;
27-
import java.io.File;
2827
import java.nio.file.Path;
2928
import java.util.Collection;
3029
import java.util.Set;
@@ -47,30 +46,6 @@
4746
)
4847
@SuppressWarnings("PMD.ImmutableField")
4948
public final class RegisterMojo extends SafeMojo {
50-
51-
/**
52-
* Directory in which {@code .eo} files are located.
53-
*
54-
* <p>If you need to register {@code .eo} files located in many directories,
55-
* you can use the {@code &lt;includeSources&gt;} feature, for example:</p>
56-
*
57-
* <pre> &lt;configuration&gt;
58-
* &lt;sourcesDir&gt;/&lt;/sourcesDir&gt;
59-
* &lt;includeSources&gt;
60-
* &lt;glob&gt;tmp/&#42;&#42;/&#42;.eo&lt;/glob&gt;
61-
* &lt;glob&gt;src/main/&#42;&#42;/&#42;.eo&lt;/glob&gt;
62-
* &lt;/includeSources&gt;
63-
* &lt;/configuration&gt;</pre>
64-
*
65-
* @checkstyle MemberNameCheck (7 lines)
66-
*/
67-
@Parameter(
68-
property = "eo.sourcesDir",
69-
required = true,
70-
defaultValue = "${project.basedir}/src/main/eo"
71-
)
72-
private File sourcesDir;
73-
7449
/**
7550
* List of inclusion GLOB filters for finding EO files
7651
* in the {@code <includeSources>} directory, which can be

eo-maven-plugin/src/test/java/org/eolang/maven/RandomProgramResolver.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public Object resolveParameter(final ParameterContext context,
4848
final ExtensionContext ext) {
4949
return String.join(
5050
"\n",
51-
"+unlint object-has-data\n",
5251
"# This is a random program in EO, which supposedly",
5352
"# complies with all syntactic rules of the language,",
5453
"# include the requirements for comments.",

eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@
2727
+tests
2828
+package org.eolang.examples
2929
+version 0.0.0
30-
+unlint atom-is-not-unique
31-
+unlint broken-ref
32-
+unlint incorrect-alias
33-
+unlint object-is-not-unique
34-
+unlint broken-alias-second
35-
+unlint object-has-data
3630

3731
3.14 > pi
3832

eo-runtime/pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,16 @@ SOFTWARE.
245245
<configuration>
246246
<withRuntimeDependency>false</withRuntimeDependency>
247247
<placeBinariesThatHaveSources>true</placeBinariesThatHaveSources>
248+
<lintAsPackage>false</lintAsPackage>
248249
</configuration>
249250
</execution>
250251
<execution>
251252
<id>test-compile</id>
252253
<phase>generate-test-sources</phase>
253254
<goals>
254255
<goal>register</goal>
255-
<goal>compile</goal>
256+
<goal>assemble</goal>
257+
<goal>lint</goal>
256258
<goal>xmir-to-phi</goal>
257259
<goal>phi-to-xmir</goal>
258260
<goal>transpile</goal>

eo-runtime/src/main/eo/org/eolang/math/e.eo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
+home https://github.com/objectionary/eo
2525
+package org.eolang.math
2626
+version 0.0.0
27+
+unlint unit-test-missing
2728

2829
# The Euler's number.
2930
# A fundamental mathematical constant approximately equal to 2.7182818284590452354.

eo-runtime/src/main/eo/org/eolang/txt/text.eo

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232

3333
# Text.
3434
# A sequence of characters representing words, sentences, or data.
35-
# @todo #3481:30min Remove all +unlit metas from EO source code.
36-
# These suppressions were added in order to be compile EO when @ref attribute
37-
# from XMIR is removed, by it's checked by LintMojo. We need to remove these
38-
# suppressions when `lints` repository is fixed and new version is used in EO.
3935
[origin] > text
4036
origin > @
4137
# Check that all signs in string are numbers or letters.

0 commit comments

Comments
 (0)