Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsimon committed Mar 29, 2022
1 parent c21d573 commit d323e17
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
6 changes: 0 additions & 6 deletions checks/evaluation/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@
package evaluation

import (
"errors"
"fmt"

"github.com/ossf/scorecard/v4/checker"
sce "github.com/ossf/scorecard/v4/errors"
)

var (
errInvalidArgType = errors.New("invalid arg type")
errInvalidArgLength = errors.New("invalid arg length")
)

// License applies the score policy for the License check.
func License(name string, dl checker.DetailLogger,
r *checker.LicenseData,
Expand Down
13 changes: 8 additions & 5 deletions checks/raw/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,19 @@ var (
func License(c *checker.CheckRequest) (checker.LicenseData, error) {
var results checker.LicenseData
var path string

err := fileparser.OnAllFilesDo(c.RepoClient, isLicenseFile, &path)
if err != nil {
return results, fmt.Errorf("fileparser.OnAllFilesDo: %w", err)
}

results.Files = append(results.Files,
checker.File{
Path: path,
Type: checker.FileTypeSource,
})
if path != "" {
results.Files = append(results.Files,
checker.File{
Path: path,
Type: checker.FileTypeSource,
})
}

return results, nil
}
Expand Down
10 changes: 0 additions & 10 deletions checks/raw/license_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,7 @@
package raw

import (
"context"
"errors"
"testing"

"github.com/golang/mock/gomock"

"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/clients"
"github.com/ossf/scorecard/v4/clients/localdir"
"github.com/ossf/scorecard/v4/log"
scut "github.com/ossf/scorecard/v4/utests"
)

func TestLicenseFileCheck(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions e2e/license_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = Describe("E2E TEST:"+checks.CheckLicense, func() {
NumberOfInfo: 1,
NumberOfDebug: 0,
}
result := checks.LicenseCheck(&req)
result := checks.License(&req)

Expect(result.Error).Should(BeNil())
Expect(result.Pass).Should(BeTrue())
Expand Down Expand Up @@ -76,7 +76,7 @@ var _ = Describe("E2E TEST:"+checks.CheckLicense, func() {
NumberOfInfo: 1,
NumberOfDebug: 0,
}
result := checks.LicenseCheck(&req)
result := checks.License(&req)

Expect(result.Error).Should(BeNil())
Expect(result.Pass).Should(BeTrue())
Expand Down

0 comments on commit d323e17

Please sign in to comment.