Skip to content

Commit

Permalink
fix(github): remove unused 'members' var (trufflesecurity#2202)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgmz authored Dec 14, 2023
1 parent f6bbc59 commit b3040b1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/sources/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ type Source struct {
jobID sources.JobID
verify bool
repos []string
members []string
orgsCache cache.Cache
filteredRepoCache *filteredRepoCache
memberCache map[string]struct{}
Expand Down Expand Up @@ -632,7 +631,7 @@ func (s *Source) enumerateWithToken(ctx context.Context, apiEndpoint, token stri
}

if s.conn.ScanUsers {
s.log.Info("Adding repos", "members", len(s.members), "orgs", s.orgsCache.Count())
s.log.Info("Adding repos", "members", len(s.memberCache), "orgs", s.orgsCache.Count())
s.addReposForMembers(ctx)
return nil
}
Expand Down Expand Up @@ -702,8 +701,8 @@ func (s *Source) enumerateWithApp(ctx context.Context, apiEndpoint string, app *
if err != nil {
return nil, err
}
s.log.Info("Scanning repos", "org_members", len(s.members))
for _, member := range s.members {
s.log.Info("Scanning repos", "org_members", len(s.memberCache))
for member := range s.memberCache {
logger := s.log.WithValues("member", member)
if err := s.getReposByUser(ctx, member); err != nil {
logger.Error(err, "error fetching gists by user")
Expand Down Expand Up @@ -877,7 +876,7 @@ func (s *Source) handleRateLimit(errIn error, res *github.Response) bool {
}

func (s *Source) addReposForMembers(ctx context.Context) {
s.log.Info("Fetching repos from members", "members", len(s.members))
s.log.Info("Fetching repos from members", "members", len(s.memberCache))
for member := range s.memberCache {
if err := s.addUserGistsToCache(ctx, member); err != nil {
s.log.Info("Unable to fetch gists by user", "user", member, "error", err)
Expand Down

0 comments on commit b3040b1

Please sign in to comment.