Skip to content

Commit

Permalink
refactor: Addressed linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Robison, Jim B <jim.b.robison@lmco.com>
  • Loading branch information
jimrobison committed May 3, 2023
1 parent 91d8f6c commit 0881a68
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
12 changes: 6 additions & 6 deletions checks/packaging.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package checks

import (
"errors"

"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/checks/evaluation"
"github.com/ossf/scorecard/v4/checks/raw/github"
Expand All @@ -42,13 +40,15 @@ func Packaging(c *checker.CheckRequest) checker.CheckResult {
var rawData checker.PackagingData
var err error

if _, clientType := c.RepoClient.(*githubrepo.Client); clientType {
switch v := c.RepoClient.(type) {
case *githubrepo.Client:
rawData, err = github.Packaging(c)
} else if _, clientType := c.RepoClient.(*gitlabrepo.Client); clientType {
case *gitlabrepo.Client:
rawData, err = gitlab.Packaging(c)
} else {
err = errors.New("invalid RepoClient")
default:
_ = v
}

if err != nil {
e := sce.WithMessage(sce.ErrScorecardInternal, err.Error())
return checker.CreateRuntimeErrorResult(CheckPackaging, e)
Expand Down
2 changes: 1 addition & 1 deletion checks/raw/gitlab/packaging.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func StringPointer(s string) *string {
}

func isGitlabPackagingWorkflow(fc []byte, fp string) (checker.File, bool) {
var lineNumber uint = checker.OffsetDefault
lineNumber := checker.OffsetDefault

packagingStrings := []string{
"docker push",
Expand Down
3 changes: 3 additions & 0 deletions checks/raw/gitlab/packaging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"testing"

"github.com/golang/mock/gomock"

"github.com/ossf/scorecard/v4/checker"
mockrepo "github.com/ossf/scorecard/v4/clients/mockclients"
)
Expand Down Expand Up @@ -135,6 +136,7 @@ func TestGitlabPackagingPackager(t *testing.T) {

moqRepoClient.EXPECT().GetFileContent(tt.filename).
DoAndReturn(func(b string) ([]byte, error) {
//nolint: errcheck
content, _ := os.ReadFile(b)
return content, nil
}).AnyTimes()
Expand All @@ -148,6 +150,7 @@ func TestGitlabPackagingPackager(t *testing.T) {
Repo: moqRepo,
}

//nolint: errcheck
packagingData, _ := Packaging(&req)

if !tt.exists {
Expand Down
3 changes: 1 addition & 2 deletions checks/raw/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ import (

"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/checks/fileparser"
"github.com/ossf/scorecard/v4/checks/raw/github"
sce "github.com/ossf/scorecard/v4/errors"
"github.com/ossf/scorecard/v4/finding"

"github.com/ossf/scorecard/v4/checks/raw/github"
)

type permission string
Expand Down

0 comments on commit 0881a68

Please sign in to comment.