diff --git a/src/main/java/com/bartek/esa/EsaMain.java b/src/main/java/com/bartek/esa/EsaMain.java index 96fffa8..aab71b6 100644 --- a/src/main/java/com/bartek/esa/EsaMain.java +++ b/src/main/java/com/bartek/esa/EsaMain.java @@ -4,7 +4,6 @@ import com.bartek.esa.analyser.apk.ApkAnalyser; import com.bartek.esa.analyser.source.SourceAnalyser; import com.bartek.esa.cli.model.CliArgsOptions; import com.bartek.esa.cli.parser.CliArgsParser; -import com.bartek.esa.core.model.enumeration.Severity; import com.bartek.esa.core.model.object.Issue; import com.bartek.esa.di.DaggerDependencyInjector; import com.bartek.esa.dispatcher.dispatcher.MethodDispatcher; @@ -44,7 +43,7 @@ public class EsaMain { } private void exitWithErrorIfAnyIssueIsAnError(Set issues) { - if(issues.stream().anyMatch(i -> i.getSeverity() == Severity.ERROR)) { + if(issues.stream().anyMatch(i -> i.getSeverity().isExitWithError())) { System.exit(1); } } diff --git a/src/main/java/com/bartek/esa/core/model/enumeration/Severity.java b/src/main/java/com/bartek/esa/core/model/enumeration/Severity.java index 78b81ea..81dfd5f 100644 --- a/src/main/java/com/bartek/esa/core/model/enumeration/Severity.java +++ b/src/main/java/com/bartek/esa/core/model/enumeration/Severity.java @@ -1,6 +1,17 @@ package com.bartek.esa.core.model.enumeration; +import lombok.Getter; + +@Getter public enum Severity { - WARNING, - ERROR + INFO(false), + WARNING(false), + ERROR(true), + VULNERABILITY(true); + + private final boolean exitWithError; + + Severity(boolean exitWithError) { + this.exitWithError = exitWithError; + } } diff --git a/src/main/java/com/bartek/esa/formatter/formatter/ColorFormatter.java b/src/main/java/com/bartek/esa/formatter/formatter/ColorFormatter.java index 17f436d..d9b2b7d 100644 --- a/src/main/java/com/bartek/esa/formatter/formatter/ColorFormatter.java +++ b/src/main/java/com/bartek/esa/formatter/formatter/ColorFormatter.java @@ -87,8 +87,10 @@ public class ColorFormatter implements Formatter { private Ansi.Color getColorForSeverity(Issue issue) { switch(issue.getSeverity()) { + case INFO: return GREEN; case WARNING: return YELLOW; - case ERROR: return RED; + case ERROR: return MAGENTA; + case VULNERABILITY: return RED; } return RED;