From ff085478aaa6051c3f6bc9b375806ec02710bc96 Mon Sep 17 00:00:00 2001 From: gotbadger Date: Mon, 4 Sep 2023 12:45:43 +0100 Subject: [PATCH] fix: report failure data was incorrect --- pkg/commands/artifact/run.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/commands/artifact/run.go b/pkg/commands/artifact/run.go index e681676f8..2258e9ef0 100644 --- a/pkg/commands/artifact/run.go +++ b/pkg/commands/artifact/run.go @@ -270,7 +270,7 @@ func Run(ctx context.Context, opts flag.Options) (err error) { return fmt.Errorf("scan error: %w", err) } - reportPassed, err := r.Report(files, baseBranchFindings) + reportFailed, err := r.Report(files, baseBranchFindings) if err != nil { return fmt.Errorf("report error: %w", err) } else { @@ -289,7 +289,7 @@ func Run(ctx context.Context, opts flag.Options) (err error) { outputhandler.StdErrLog(fmt.Sprintf("=====================================\n\nProfile\n\n%s", stats.String())) } - if !reportPassed { + if reportFailed { if scanSettings.Scan.ExitCode == -1 { defer os.Exit(1) } else { @@ -306,7 +306,6 @@ func (r *runner) Report( ) (bool, error) { startTime := time.Now() cacheUsed := r.CacheUsed() - reportPassed := true report := types.Report{Path: r.reportPath, Inputgocloc: r.goclocResult} @@ -363,7 +362,7 @@ func (r *runner) Report( outputCachedDataWarning(cacheUsed, r.scanSettings.Scan.Quiet) - return reportPassed, nil + return reportData.ReportFailed, nil } func (r *runner) ReportPath() string {