Skip to content

Commit

Permalink
Fix linter.
Browse files Browse the repository at this point in the history
Signed-off-by: Spencer Schrock <sschrock@google.com>
  • Loading branch information
spencerschrock committed Feb 10, 2023
1 parent 8b486cb commit b87025c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pkg/scorecard_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import (
sclog "github.com/ossf/scorecard/v4/log"
)

func (s *ScorecardResult) normalize() {
s.Date = time.Time{}
sort.Slice(s.Checks, func(i, j int) bool {
return s.Checks[i].Name < s.Checks[j].Name
func (r *ScorecardResult) normalize() {
r.Date = time.Time{}
sort.Slice(r.Checks, func(i, j int) bool {
return r.Checks[i].Name < r.Checks[j].Name
})
}

Expand All @@ -52,16 +52,20 @@ func countDetails(c []checker.CheckDetail) (debug, info, warn int) {
return debug, info, warn
}

//nolint:lll,gocritic // comparison was failing with pointer types
func compareScorecardResults(a, b ScorecardResult) bool {
if a.Repo != b.Repo || a.Scorecard != b.Scorecard {
if a.Repo != b.Repo {
fmt.Fprintf(GinkgoWriter, "Unequal repo details in results: %v vs %v\n", a.Repo, b.Repo)
return false
}
if a.Scorecard != b.Scorecard {
fmt.Fprintf(GinkgoWriter, "Unequal scorecard details in results: %v vs %v\n", a.Scorecard, b.Scorecard)
return false
}

if len(a.Checks) != len(b.Checks) {
fmt.Fprintf(GinkgoWriter, "Unequal number of checks in results: %d vs %d\n", len(a.Checks), len(b.Checks))
return false
}

for i := range a.Checks {
if a.Checks[i].Name != b.Checks[i].Name {
fmt.Fprintf(GinkgoWriter, "Check name mismatch: %q vs %q\n", a.Checks[i].Name, b.Checks[i].Name)
Expand Down

0 comments on commit b87025c

Please sign in to comment.