Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
[fix] Report the unit in a single scan job (#4209)
Miccahab1b459b2b0f
diff --git a/pkg/sources/job_progress.go b/pkg/sources/job_progress.goindex 1b7bc6ac2..e3965e4e6 100644--- a/pkg/sources/job_progress.go+++ b/pkg/sources/job_progress.go@@ -355,6 +355,10 @@ func (m JobProgressMetrics) PercentComplete() int {// Fallback to the source's self-reported percent complete if// the unit information isn't available.return int(m.SourcePercent)+ } else if den == 0 {+ // This should never happen. Return an invalid value so we can+ // trace it back to here if we ever see it.+ return -1}return int(num * 100 / den)}diff --git a/pkg/sources/source_manager.go b/pkg/sources/source_manager.goindex 48f369ec3..68dd57f77 100644--- a/pkg/sources/source_manager.go+++ b/pkg/sources/source_manager.go@@ -417,6 +417,7 @@ func (s *SourceManager) scan(ctx context.Context, source Source, report *JobProg}}()+ report.ReportUnit(unit)report.TrackProgress(source.GetProgress())if ctx.Value("job_id") == "" {ctx = context.WithValue(ctx, "job_id", report.JobID)