Skip to content

Commit e096b80

Browse files
authored
Error out when we encounter an organization with no repos present. That could indicate improper auth or a typo in the org name. Added skipping of printing the results if no findings are present (#79)
1 parent 3b4b230 commit e096b80

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

analyze/analyze.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,11 @@ func (a *Analyzer) finalizeAnalysis(ctx context.Context, inventory *scanner.Inve
282282
return err
283283
}
284284

285+
if len(report.Findings) == 0 {
286+
log.Info().Msg("No results returned by analysis")
287+
return nil
288+
}
289+
285290
err = a.Formatter.Format(ctx, report, inventory.Packages)
286291
if err != nil {
287292
return err

providers/github/client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@ func (c *Client) GetOrgRepos(ctx context.Context, org string) <-chan analyze.Rep
271271
return
272272
}
273273

274+
if query.RepositoryOwner.Repositories.TotalCount == 0 {
275+
log.Error().Msgf("No repositories found for org %s", org)
276+
batchChan <- analyze.RepoBatch{Err: fmt.Errorf("no repositories found for org %s", org)}
277+
return
278+
}
279+
274280
totalCount := 0
275281
if !totalCountSent {
276282
totalCount = query.RepositoryOwner.Repositories.TotalCount

0 commit comments

Comments
 (0)