Skip to content

Commit

Permalink
don't attempt staticanalysis results upload (and log a warning) when …
Browse files Browse the repository at this point in the history
…there is no data (#878)

Signed-off-by: Max Fisher <[email protected]>
  • Loading branch information
maxfisher-g authored Sep 12, 2023
1 parent 8b19e90 commit 6fba767
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions internal/worker/save_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ func saveExecutionLog(ctx context.Context, pkg *pkgmanager.Pkg, dest *ResultStor
func SaveStaticAnalysisData(ctx context.Context, pkg *pkgmanager.Pkg, dest *ResultStores, data analysisrun.StaticAnalysisResults) error {
if dest.StaticAnalysis == nil {
return nil
} else if len(data) == 0 {
slog.WarnContext(ctx, "static analysis data is empty")
return nil
}

if err := dest.StaticAnalysis.SaveStaticAnalysis(ctx, pkg, data, ""); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions sandboxes/staticanalysis/staticanalyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ func run() (err error) {
}
}

err = manager.ExtractArchive(archivePath, workDirs.extractDir)
if err != nil {
if err := manager.ExtractArchive(archivePath, workDirs.extractDir); err != nil {
return fmt.Errorf("archive extraction failed: %w", err)
}

Expand Down

0 comments on commit 6fba767

Please sign in to comment.