Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsimon committed Sep 9, 2021
1 parent 8bc014b commit 93edf14
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
3 changes: 2 additions & 1 deletion docs/checks/internal/generate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import (

func main() {
if len(os.Args) != 2 {
panic(fmt.Errorf("Usage: %s filename", os.Args[0]))
// nolint: goerr113
panic(fmt.Errorf("usage: %s filename", os.Args[0]))
}
yamlFile := os.Args[1]

Expand Down
3 changes: 2 additions & 1 deletion docs/checks/internal/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import (
//go:embed checks.yaml
var checksYAML []byte

// InternalCheck stores a check's information.
// nolint:govet
// Check stores a check's information.
type Check struct {
Risk string `yaml:"-"`
Short string `yaml:"short"`
Expand Down
3 changes: 1 addition & 2 deletions docs/checks/internal/validate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ func main() {
for check := range allChecks {
c, e := m.GetCheck(check)
if e != nil {
// nolint: goerr113
panic(fmt.Errorf("GetCheck: %v: %s", e, check))
panic(fmt.Errorf("GetCheck: %w: %s", e, check))
}

if c.GetDescription() == "" {
Expand Down
8 changes: 3 additions & 5 deletions pkg/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/ossf/scorecard/v2/checker"
)

func jsonMockDocRead() (*mockDoc, error) {
func jsonMockDocRead() *mockDoc {
d := map[string]mockCheck{
"Check-Name": {
name: "Check-Name",
Expand Down Expand Up @@ -62,7 +62,7 @@ func jsonMockDocRead() (*mockDoc, error) {
}

m := mockDoc{checks: d}
return &m, nil
return &m
}

//nolint
Expand All @@ -78,9 +78,7 @@ func TestJSONOutput(t *testing.T) {
panic(fmt.Errorf("time.Parse: %w", e))
}

// Note: our implementation of the interface
// never throws an error for unit testing.
checkDocs, _ := jsonMockDocRead()
checkDocs := jsonMockDocRead()

tests := []struct {
name string
Expand Down
1 change: 1 addition & 0 deletions pkg/mock_doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type mockDoc struct {
}

func (d *mockDoc) GetCheck(name string) (docs.CheckDoc, error) {
// nolint: gosimple
m, _ := d.checks[name]
return &m, nil
}
Expand Down
1 change: 1 addition & 0 deletions pkg/sarif.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ func (r *ScorecardResult) AsSARIF(showDetails bool, logLevel zapcore.Level,
encoder := json.NewEncoder(writer)
encoder.SetIndent("", " ")
if err := encoder.Encode(sarif); err != nil {
// nolint: wrapcheck
return sce.Create(sce.ErrScorecardInternal, err.Error())
}

Expand Down
8 changes: 3 additions & 5 deletions pkg/sarif_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/ossf/scorecard/v2/checker"
)

func sarifMockDocRead() (*mockDoc, error) {
func sarifMockDocRead() *mockDoc {
d := map[string]mockCheck{
"Check-Name": {
name: "Check-Name",
Expand Down Expand Up @@ -58,7 +58,7 @@ func sarifMockDocRead() (*mockDoc, error) {
}

m := mockDoc{checks: d}
return &m, nil
return &m
}

//nolint
Expand All @@ -82,9 +82,7 @@ func TestSARIFOutput(t *testing.T) {
panic(fmt.Errorf("time.Parse: %w", e))
}

// Note: our implementation of the interface
// never throws an error for unit testing.
checkDocs, _ := sarifMockDocRead()
checkDocs := sarifMockDocRead()

tests := []struct {
name string
Expand Down

0 comments on commit 93edf14

Please sign in to comment.