Skip to content

Commit

Permalink
use new toplevel gitmode argument
Browse files Browse the repository at this point in the history
also moves a func around for smaller PR diff.

Signed-off-by: Spencer Schrock <sschrock@google.com>
  • Loading branch information
spencerschrock committed Jan 2, 2025
1 parent ff33e0c commit 498e3c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
14 changes: 7 additions & 7 deletions clients/githubrepo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,6 @@ func CreateGithubRepoClientWithTransport(ctx context.Context, rt http.RoundTripp
return rc
}

// CreateGithubRepoClient returns a Client which implements RepoClient interface.
func CreateGithubRepoClient(ctx context.Context, logger *log.Logger) clients.RepoClient {
// Use our custom roundtripper
rt := roundtripper.NewTransport(ctx, logger)
return CreateGithubRepoClientWithTransport(ctx, rt)
}

// NewRepoClient returns a Client which implements RepoClient interface.
// It can be configured with various [Option]s.
func NewRepoClient(ctx context.Context, opts ...Option) (clients.RepoClient, error) {
Expand Down Expand Up @@ -430,6 +423,13 @@ func NewRepoClient(ctx context.Context, opts ...Option) (clients.RepoClient, err
}, nil
}

// CreateGithubRepoClient returns a Client which implements RepoClient interface.
func CreateGithubRepoClient(ctx context.Context, logger *log.Logger) clients.RepoClient {
// Use our custom roundtripper
rt := roundtripper.NewTransport(ctx, logger)
return CreateGithubRepoClientWithTransport(ctx, rt)
}

// CreateOssFuzzRepoClient returns a RepoClient implementation
// initialized to `google/oss-fuzz` GitHub repository.
//
Expand Down
7 changes: 2 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,9 @@ func rootCmd(o *options.Options) error {
scorecard.WithChecks(checks),
}
if o.GitMode {
rc, err := githubrepo.NewRepoClient(ctx, githubrepo.WithGitMode())
if err != nil {
return fmt.Errorf("enabling github git mode: %w", err)
}
opts = append(opts, scorecard.WithRepoClient(rc))
opts = append(opts, scorecard.WithGitMode())
}

repoResult, err = scorecard.Run(ctx, repo, opts...)
if err != nil {
return fmt.Errorf("scorecard.Run: %w", err)
Expand Down

0 comments on commit 498e3c5

Please sign in to comment.