Skip to content

Commit

Permalink
assign findings in runEnabledProbes
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Korczynski <[email protected]>
  • Loading branch information
AdamKorcz committed Dec 8, 2023
1 parent 4f1833b commit b69caff
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/scorecard.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,10 @@ func runScorecard(ctx context.Context,

// If the user runs probes
if len(probesToRun) > 0 {
findings, err := runEnabledProbes(request, probesToRun, &ret)
err = runEnabledProbes(request, probesToRun, &ret)
if err != nil {
return ScorecardResult{}, err
}
ret.Findings = findings
return ret, nil
}

Expand Down Expand Up @@ -190,11 +189,11 @@ func runScorecard(ctx context.Context,
func runEnabledProbes(request *checker.CheckRequest,
probesToRun []string,
ret *ScorecardResult,
) ([]finding.Finding, error) {
) error {
// Add RawResults to request
err := populateRawResults(request, probesToRun, ret)
if err != nil {
return nil, err
return err
}

Check warning on line 197 in pkg/scorecard.go

View check run for this annotation

Codecov / codecov/patch

pkg/scorecard.go#L196-L197

Added lines #L196 - L197 were not covered by tests

probeFindings := make([]finding.Finding, 0)
Expand All @@ -203,16 +202,17 @@ func runEnabledProbes(request *checker.CheckRequest,
probeRunner, err := probes.GetProbeRunner(probeName)
if err != nil {
msg := fmt.Sprintf("could not find probe: %s", probeName)
return nil, sce.WithMessage(sce.ErrScorecardInternal, msg)
return sce.WithMessage(sce.ErrScorecardInternal, msg)
}
// Run probe
findings, _, err := probeRunner(&ret.RawResults)
if err != nil {
return nil, sce.WithMessage(sce.ErrScorecardInternal, "ending run")
return sce.WithMessage(sce.ErrScorecardInternal, "ending run")
}

Check warning on line 211 in pkg/scorecard.go

View check run for this annotation

Codecov / codecov/patch

pkg/scorecard.go#L210-L211

Added lines #L210 - L211 were not covered by tests
probeFindings = append(probeFindings, findings...)
}
return probeFindings, nil
ret.Findings = probeFindings
return nil
}

// RunScorecard runs enabled Scorecard checks on a Repo.
Expand Down

0 comments on commit b69caff

Please sign in to comment.