Skip to content

Commit

Permalink
Fix fail date nil (#86)
Browse files Browse the repository at this point in the history
Signed-off-by: Benji Visser <benji@093b.org>
  • Loading branch information
noqcks authored Jul 25, 2023
1 parent 46fbd74 commit 4453938
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/ui/common_event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ func handlePolicyEvaluationMessage(event partybus.Event, reportOutput io.Writer)

var message string
if pt.Type == policy.PolicyTypeDeny {
message = color.Red.Sprintf("[%s] Policy Violation: %s (v%s) needs to upgraded to a newer version. This scan will now exit non-zero.\n\n", pt.Type, pt.ProductName, pt.Cycle)
message = color.Red.Sprintf("[%s] Policy Violation: %s (v%s) needs to upgraded to a newer version. This scan will now exit non-zero.\n", pt.Type, pt.ProductName, pt.Cycle)
} else {
message = color.Yellow.Sprintf("[%s] Policy Violation: %s (v%s) needs to be upgraded to a newer version. This policy will fail builds starting on %s.\n\n", pt.Type, pt.ProductName, pt.Cycle, pt.FailDate)
if pt.FailDate != "" {
message = color.Yellow.Sprintf("[%s] Policy Violation: %s (v%s) needs to be upgraded to a newer version. This policy will fail builds starting on %s.\n", pt.Type, pt.ProductName, pt.Cycle, pt.FailDate)
} else {
message = color.Yellow.Sprintf("[%s] Policy Violation: %s (v%s) needs to be upgraded to a newer version.\n", pt.Type, pt.ProductName, pt.Cycle)
}
}
if _, err := reportOutput.Write([]byte(message)); err != nil {
return fmt.Errorf("unable to show policy evaluation message: %w", err)
Expand Down

0 comments on commit 4453938

Please sign in to comment.