Skip to content

Commit

Permalink
Fixup/nolint lint warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Augustus <foo@auggie.dev>
  • Loading branch information
justaugustus committed Mar 1, 2022
1 parent fe783f1 commit 38aea8f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion entrypoint/entrypoint.go
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions entrypoint/entrypoint_test.go
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion options/env.go
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions options/options.go
Expand Up @@ -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() != ""
}
Expand Down
11 changes: 6 additions & 5 deletions options/options_test.go
Expand Up @@ -19,6 +19,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"

scopts "github.com/ossf/scorecard/v4/options"
)

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 38aea8f

Please sign in to comment.