Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: report failure data was incorrect #1240

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions pkg/commands/artifact/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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}

Expand Down Expand Up @@ -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 {
Expand Down
Loading