Skip to content

Commit

Permalink
scan: fix missing newline, make less noisy (#601)
Browse files Browse the repository at this point in the history
* scan: fix missing newline, make less noisy

* improve comment wording
  • Loading branch information
tstromberg authored Nov 7, 2024
1 parent 8e1f837 commit 0e449cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pkg/render/terminal_brief.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ func (r TerminalBrief) File(_ context.Context, fr *malcontent.FileReport) error

for _, b := range fr.Behaviors {
content := fmt.Sprintf("│ %s %s — %s", riskColor(fr.RiskLevel, "•"), riskColor(fr.RiskLevel, b.ID), b.Description)
fmt.Fprint(r.w, content)

e := evidenceString(b.MatchStrings, b.Description)

// no evidence to give
if e == "" {
fmt.Println(r.w, "")
continue
}

fmt.Fprint(r.w, content)
color.New(color.FgHiBlack).Fprint(r.w, ":")
e = color.RGB(255, 255, 255).Sprint(e)

Expand Down
4 changes: 2 additions & 2 deletions pkg/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func mungeDescription(s string) string {
}

//nolint:cyclop // ignore complexity of 44
func Generate(ctx context.Context, path string, mrs yara.MatchRules, c malcontent.Config, expath string, logger *clog.Logger) (malcontent.FileReport, error) {
func Generate(ctx context.Context, path string, mrs yara.MatchRules, c malcontent.Config, expath string, _ *clog.Logger) (malcontent.FileReport, error) {
ignoreTags := c.IgnoreTags
minScore := c.MinRisk
ignoreSelf := c.IgnoreSelf
Expand Down Expand Up @@ -464,7 +464,7 @@ func Generate(ctx context.Context, path string, mrs yara.MatchRules, c malconten
b.Override = append(b.Override, k)
fr.Overrides = append(fr.Overrides, b)
case !exists && override:
logger.Errorf("Override %s matched with no overridden rule\n", m.Rule)
// TODO: return error if override references an unknown rule name
continue
}

Expand Down

0 comments on commit 0e449cf

Please sign in to comment.