diff --git a/entrypoint/entrypoint.go b/entrypoint/entrypoint.go index c88a18d9..9ef28061 100644 --- a/entrypoint/entrypoint.go +++ b/entrypoint/entrypoint.go @@ -49,7 +49,7 @@ func Run(o *options.Options) error { // The repository should have already been initialized, so if for whatever // reason it hasn't, we should exit here with an appropriate error if o.RepoIsSet() { - return errors.New("repository cannot be empty") + return fmt.Errorf("repository cannot be empty") //nolint:goerr113 // TODO(lint): Fix } token := options.GetGithubToken() diff --git a/entrypoint/entrypoint_test.go b/entrypoint/entrypoint_test.go index c8d88720..25b7fa46 100644 --- a/entrypoint/entrypoint_test.go +++ b/entrypoint/entrypoint_test.go @@ -95,9 +95,9 @@ func Test_RepoIsFork(t *testing.T) { } } +//nolint:paralleltest +// Not setting t.Parallel() here because we are mutating the env variables. func TestInitializeEnvVariables(t *testing.T) { - //nolint:paralleltest - // Not setting t.Parallel() here because we are mutating the env variables. tests := []struct { opts *options.Options name string diff --git a/options/env.go b/options/env.go index 7bc1c4e3..3e2813bf 100644 --- a/options/env.go +++ b/options/env.go @@ -41,7 +41,7 @@ const ( EnvScorecardPrivateRepo = "SCORECARD_PRIVATE_REPOSITORY" ) -// CheckRequired is a function to check if the required environment variables are set. +// CheckRequiredEnv is a function to check if the required environment variables are set. func CheckRequiredEnv() error { envVariables := make(map[string]bool) envVariables[EnvGithubRepository] = true diff --git a/options/options.go b/options/options.go index 10f02348..6b63eed3 100644 --- a/options/options.go +++ b/options/options.go @@ -205,6 +205,7 @@ func (o *Options) Repo() string { return o.ScorecardOpts.Repo } +// RepoIsSet TODO(lint): should have comment or be unexported (revive). func (o *Options) RepoIsSet() bool { return o.Repo() != "" } diff --git a/options/options_test.go b/options/options_test.go index b1f1fc7c..e4110545 100644 --- a/options/options_test.go +++ b/options/options_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" + scopts "github.com/ossf/scorecard/v4/options" ) @@ -57,10 +58,10 @@ func TestNew(t *testing.T) { } */ +//nolint:paralleltest // Until/unless we consider providing a fake environment +// to tests, running these in parallel will have unpredictable results as +// we're mutating environment variables. func TestOptionsInitialize(t *testing.T) { - //nolint:paralleltest // Until/unless we consider providing a fake environment - // to tests, running these in parallel will have unpredictable results as - // we're mutating environment variables. type fields struct { ScorecardOpts *scopts.Options GithubEventName string @@ -70,7 +71,7 @@ func TestOptionsInitialize(t *testing.T) { PublishResults string ResultsFile string } - tests := []struct { + tests := []struct { //nolint:govet // TODO(lint): Fix name string fields fields wantErr bool @@ -102,7 +103,7 @@ func TestOptionsInitialize(t *testing.T) { os.Setenv(EnvGithubEventPath, tt.githubEventPath) } - o, _ := New() + o, _ := New() //nolint:errcheck // TODO(lint): Fix t.Logf("options before initialization: %+v", o) optsBeforeInit := o