add a no-fail flag

This commit is contained in:
JulesDT 2019-01-25 12:04:43 -05:00 committed by Cosmin Cojocar
parent a966ff760c
commit 04ce7baf6c

View file

@ -97,6 +97,9 @@ var (
// fail by severity // fail by severity
flagSeverity = flag.String("severity", "low", "Fail the scanning for issues with the given or higher severity. Valid options are: low, medium, high") flagSeverity = flag.String("severity", "low", "Fail the scanning for issues with the given or higher severity. Valid options are: low, medium, high")
// do not fail
flagNoFail = flag.Bool("no-fail", false, "Do not fail the scanning, even if issues were found")
logger *log.Logger logger *log.Logger
) )
@ -348,8 +351,8 @@ func main() {
// Finalize logging // Finalize logging
logWriter.Close() // #nosec logWriter.Close() // #nosec
// Do we have an issue? If so exit 1 // Do we have an issue? If so exit 1 unless NoFail is set
if issuesFound { if issuesFound && !*flagNoFail {
os.Exit(1) os.Exit(1)
} }
} }