Skip to content

Commit

Permalink
✨ print a grayed section if no risks are downgrading the asset (#1225)
Browse files Browse the repository at this point in the history
instead of leaving it empty

Signed-off-by: Dominik Richter <[email protected]>
  • Loading branch information
arlimus authored Apr 4, 2024
1 parent 8d5b7c5 commit b3864f0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cli/reporter/print_compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,7 @@ func (r *defaultReporter) printAssetRisks(resolved *policy.ResolvedPolicy, repor
return
}

r.out(NewLineCharacter + "Risks/Mitigations:" + NewLineCharacter)

var res strings.Builder
for i := range report.Risks.Items {
risk := report.Risks.Items[i]
if !risk.IsDetected {
Expand All @@ -533,7 +532,15 @@ func (r *defaultReporter) printAssetRisks(resolved *policy.ResolvedPolicy, repor
text = termenv.String("✓ " + text).Foreground(r.Colors.Success).String()
}

r.out(text + NewLineCharacter)
res.WriteString(text + NewLineCharacter)
}
out := res.String()

r.out(NewLineCharacter + "Risks/Mitigations:" + NewLineCharacter)
if out != "" {
r.out(out)
} else {
r.out(termenv.String("✓ no downgrading risks detected" + NewLineCharacter).Foreground(r.Colors.Disabled).String())
}
}

Expand Down

0 comments on commit b3864f0

Please sign in to comment.