Skip to content

Commit 2c24de0

Browse files
authored
Merge pull request #3897 from h1alexbel/3800
feat(#3800): LintMojo prints lints URL
2 parents df8db78 + 9dd1c48 commit 2c24de0

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

.codacy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@
2727
exclude_paths:
2828
- "src/test/groovy/*.groovy"
2929
- "eo-runtime/src/test/java/integration/PhiUnphiIT.java"
30+
- "eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java"

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

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

2626
import com.jcabi.log.Logger;
27+
import com.jcabi.manifests.Manifests;
2728
import com.jcabi.xml.XML;
2829
import com.jcabi.xml.XMLDocument;
2930
import java.io.IOException;
@@ -116,6 +117,11 @@ private void lint() throws IOException {
116117
"Linted %d out of %d XMIR program(s) that needed this (out of %d total programs) in %[ms]s: %s",
117118
passed, tojos.size(), tojos.size(), System.currentTimeMillis() - start, sum
118119
);
120+
Logger.info(
121+
this,
122+
"Read more about lints: https://www.objectionary.com/lints/%s",
123+
Manifests.read("Lints-Version")
124+
);
119125
if (counts.get(Severity.ERROR) > 0 || counts.get(Severity.CRITICAL) > 0) {
120126
throw new IllegalStateException(
121127
String.format(

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,32 @@ void lintsAgainAfterModification(@Mktmp final Path temp, @RandomProgram final St
8484
);
8585
}
8686

87+
@Test
88+
void printsLintsUrlWithVersion(@Mktmp final Path temp, @RandomProgram final String program)
89+
throws IOException {
90+
new Farea(temp).together(
91+
f -> {
92+
f.clean();
93+
f.files().file("src/main/eo/foo.eo").write(program.getBytes());
94+
f.build()
95+
.plugins()
96+
.appendItself()
97+
.execution()
98+
.goals("register", "parse", "shake", "lint")
99+
.configuration()
100+
.set("failOnWarning", "false");
101+
f.exec("process-classes");
102+
MatcherAssert.assertThat(
103+
"Lints URL was not printed, but it should",
104+
f.log().content(),
105+
Matchers.matchesPattern(
106+
"(?s).*\\[INFO] Read more about lints: https://www\\.objectionary\\.com/lints/\\d+\\.\\d+\\.\\d+.*"
107+
)
108+
);
109+
}
110+
);
111+
}
112+
87113
@Test
88114
void doesNotFailWithNoErrorsAndWarnings(@Mktmp final Path temp) {
89115
Assertions.assertDoesNotThrow(

0 commit comments

Comments
 (0)