Skip to content

Commit

Permalink
better logging for lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 17, 2024
1 parent 1d1bdf5 commit ee548da
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,24 @@ void exec() throws IOException {
this.lintAll(counts)
);
final String sum = LintMojo.summary(counts);
if (counts.get(Severity.ERROR) > 0 || counts.get(Severity.CRITICAL) > 0
|| counts.get(Severity.WARNING) > 0 && this.failOnWarning) {
Logger.info(
this,
"Linted %d out of %d XMIR program(s) that needed this (out of %d total programs): %s",
passed, tojos.size(), tojos.size(), sum
);
Logger.info(
this,
"Linted %d out of %d XMIR program(s) that needed this (out of %d total programs): %s",
passed, tojos.size(), tojos.size(), sum
);
if (counts.get(Severity.ERROR) > 0 || counts.get(Severity.CRITICAL) > 0) {
throw new IllegalStateException(
String.format("In %d XMIR files, we found %s", tojos.size(), sum)
String.format(
"In %d XMIR files, we found %s (must stop here)",
tojos.size(), sum
)
);
} else {
Logger.info(
this,
"Linted %d out of %d XMIR program(s) that needed this: %s",
passed, tojos.size(), sum
} else if (counts.get(Severity.WARNING) > 0 && this.failOnWarning) {
throw new IllegalStateException(
String.format(
"In %d XMIR files, we found %s (use -Deo.failOnWarning=false to ignore)",
tojos.size(), sum
)
);
}
}
Expand Down

0 comments on commit ee548da

Please sign in to comment.