Re-factor probe utils (#3408)

* re-factor probe utils

Signed-off-by: laurentsimon <laurentsimon@google.com>

* missing error.go file

Signed-off-by: laurentsimon <laurentsimon@google.com>

---------

Signed-off-by: laurentsimon <laurentsimon@google.com>
This commit is contained in:
laurentsimon 2023-08-21 13:16:41 -07:00 committed by GitHub
parent d177169ec2
commit f05496b994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 98 additions and 84 deletions

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/fuzzing"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,8 +32,8 @@ const Probe = "fuzzedWithClusterFuzzLite"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
//nolint:wrapcheck
return utils.FuzzerRun(raw, fs, Probe, "ClusterFuzzLite")
return fuzzing.Run(raw, fs, Probe, "ClusterFuzzLite")
}

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -111,7 +111,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/fuzzing"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,8 +32,8 @@ const Probe = "fuzzedWithGoNative"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
//nolint:wrapcheck
return utils.FuzzerRun(raw, fs, Probe, "GoBuiltInFuzzer")
return fuzzing.Run(raw, fs, Probe, "GoBuiltInFuzzer")
}

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -111,7 +111,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/fuzzing"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,8 +32,8 @@ const Probe = "fuzzedWithOSSFuzz"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
//nolint:wrapcheck
return utils.FuzzerRun(raw, fs, Probe, "OSSFuzz")
return fuzzing.Run(raw, fs, Probe, "OSSFuzz")
}

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -111,7 +111,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/fuzzing"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,8 +32,8 @@ var Probe = "fuzzedWithOneFuzz"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
//nolint:wrapcheck
return utils.FuzzerRun(raw, fs, Probe, "OneFuzz")
return fuzzing.Run(raw, fs, Probe, "OneFuzz")
}

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -111,7 +111,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/fuzzing"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,8 +32,8 @@ const Probe = "fuzzedWithPropertyBasedHaskell"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
//nolint:wrapcheck
return utils.FuzzerRun(raw, fs, Probe, "HaskellPropertyBasedTesting")
return fuzzing.Run(raw, fs, Probe, "HaskellPropertyBasedTesting")
}

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -111,7 +111,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/fuzzing"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,8 +32,8 @@ const Probe = "fuzzedWithPropertyBasedJavascript"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
//nolint:wrapcheck
return utils.FuzzerRun(raw, fs, Probe, "JavaScriptPropertyBasedTesting")
return fuzzing.Run(raw, fs, Probe, "JavaScriptPropertyBasedTesting")
}

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -111,7 +111,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/fuzzing"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,8 +32,8 @@ const Probe = "fuzzedWithPropertyBasedTypescript"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
//nolint:wrapcheck
return utils.FuzzerRun(raw, fs, Probe, "TypeScriptPropertyBasedTesting")
return fuzzing.Run(raw, fs, Probe, "TypeScriptPropertyBasedTesting")
}

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -111,7 +111,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package utils
package fuzzing
import (
"embed"
@ -22,7 +22,7 @@ import (
"github.com/ossf/scorecard/v4/finding"
)
func FuzzerRun(raw *checker.RawResults, fs embed.FS, probeID, fuzzerName string) ([]finding.Finding, string, error) {
func Run(raw *checker.RawResults, fs embed.FS, probeID, fuzzerName string) ([]finding.Finding, string, error) {
var findings []finding.Finding
fuzzers := raw.FuzzingResults.Fuzzers

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package utils
package secpolicy
import (
"github.com/ossf/scorecard/v4/checker"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package utils
package tools
import (
"embed"
@ -32,7 +32,7 @@ type toolMatcher interface {
// The function uses 'matcher' to identify the tool of interest.
// If a tool is used in the repository, it creates a finding with the 'foundOutcome'.
// If not, it returns a finding with outcome 'notFoundOutcome'.
func ToolsRun(tools []checker.Tool, fs embed.FS, probeID string,
func Run(tools []checker.Tool, fs embed.FS, probeID string,
foundOutcome, notFoundOutcome finding.Outcome, matcher toolMatcher,
) ([]finding.Finding, string, error) {
var findings []finding.Finding

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package utils
package uerror
import (
"errors"

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/secpolicy"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,14 +32,14 @@ const Probe = "securityPolicyContainsLinks"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
var findings []finding.Finding
policies := raw.SecurityPolicyResults.PolicyFiles
for i := range policies {
policy := &policies[i]
emails := utils.CountSecInfo(policy.Information, checker.SecurityPolicyInformationTypeEmail, true)
urls := utils.CountSecInfo(policy.Information, checker.SecurityPolicyInformationTypeLink, true)
emails := secpolicy.CountSecInfo(policy.Information, checker.SecurityPolicyInformationTypeEmail, true)
urls := secpolicy.CountSecInfo(policy.Information, checker.SecurityPolicyInformationTypeLink, true)
if (urls + emails) > 0 {
f, err := finding.NewPositive(fs, Probe,

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -275,7 +275,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/secpolicy"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,19 +32,19 @@ const Probe = "securityPolicyContainsText"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
var findings []finding.Finding
policies := raw.SecurityPolicyResults.PolicyFiles
for i := range policies {
policy := &policies[i]
linkedContentLen := 0
emails := utils.CountSecInfo(policy.Information, checker.SecurityPolicyInformationTypeEmail, true)
urls := utils.CountSecInfo(policy.Information, checker.SecurityPolicyInformationTypeLink, true)
for _, i := range utils.FindSecInfo(policy.Information, checker.SecurityPolicyInformationTypeEmail, true) {
emails := secpolicy.CountSecInfo(policy.Information, checker.SecurityPolicyInformationTypeEmail, true)
urls := secpolicy.CountSecInfo(policy.Information, checker.SecurityPolicyInformationTypeLink, true)
for _, i := range secpolicy.FindSecInfo(policy.Information, checker.SecurityPolicyInformationTypeEmail, true) {
linkedContentLen += len(i.InformationValue.Match)
}
for _, i := range utils.FindSecInfo(policy.Information, checker.SecurityPolicyInformationTypeLink, true) {
for _, i := range secpolicy.FindSecInfo(policy.Information, checker.SecurityPolicyInformationTypeLink, true) {
linkedContentLen += len(i.InformationValue.Match)
}

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -381,7 +381,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/secpolicy"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,13 +32,13 @@ const Probe = "securityPolicyContainsVulnerabilityDisclosure"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
var findings []finding.Finding
policies := raw.SecurityPolicyResults.PolicyFiles
for i := range policies {
policy := &policies[i]
discvuls := utils.CountSecInfo(policy.Information, checker.SecurityPolicyInformationTypeText, false)
discvuls := secpolicy.CountSecInfo(policy.Information, checker.SecurityPolicyInformationTypeText, false)
if discvuls > 1 {
f, err := finding.NewPositive(fs, Probe,
"Found disclosure, vulnerability, and/or timelines in security policy", policy.File.Location())

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -236,7 +236,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -31,7 +31,7 @@ const Probe = "securityPolicyPresent"
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
var files []checker.File
for i := range raw.SecurityPolicyResults.PolicyFiles {

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -105,7 +105,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
tls "github.com/ossf/scorecard/v4/probes/internal/utils/tools"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -41,14 +42,14 @@ func (t dependabot) Matches(tool *checker.Tool) bool {
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
tools := raw.DependencyUpdateToolResults.Tools
var matcher dependabot
// Check whether Dependabot tool is installed on the repo,
// and create the corresponding findings.
//nolint:wrapcheck
return utils.ToolsRun(tools, fs, Probe,
return tls.Run(tools, fs, Probe,
// Tool found will generate a positive result.
finding.OutcomePositive,
// Tool not found will generate a negative result.

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -93,7 +93,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
tls "github.com/ossf/scorecard/v4/probes/internal/utils/tools"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -41,14 +42,14 @@ func (t pyup) Matches(tool *checker.Tool) bool {
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
tools := raw.DependencyUpdateToolResults.Tools
var matcher pyup
// Check whether PyUp tool is installed on the repo,
// and create the corresponding findings.
//nolint:wrapcheck
return utils.ToolsRun(tools, fs, Probe,
return tls.Run(tools, fs, Probe,
// Tool found will generate a positive result.
finding.OutcomePositive,
// Tool not found will generate a negative result.

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -93,7 +93,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
tls "github.com/ossf/scorecard/v4/probes/internal/utils/tools"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -41,14 +42,14 @@ func (t renovate) Matches(tool *checker.Tool) bool {
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
tools := raw.DependencyUpdateToolResults.Tools
var matcher renovate
// Check whether Renovate tool is installed on the repo,
// and create the corresponding findings.
//nolint:wrapcheck
return utils.ToolsRun(tools, fs, Probe,
return tls.Run(tools, fs, Probe,
// Tool found will generate a positive result.
finding.OutcomePositive,
// Tool not found will generate a negative result.

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -93,7 +93,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {

View File

@ -21,7 +21,8 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
tls "github.com/ossf/scorecard/v4/probes/internal/utils/tools"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
//go:embed *.yml
@ -41,14 +42,14 @@ func (t sonatypeLyft) Matches(tool *checker.Tool) bool {
func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
if raw == nil {
return nil, "", fmt.Errorf("%w: raw", utils.ErrNil)
return nil, "", fmt.Errorf("%w: raw", uerror.ErrNil)
}
tools := raw.DependencyUpdateToolResults.Tools
var matcher sonatypeLyft
// Check whether Sona Lyft tool is installed on the repo,
// and create the corresponding findings.
//nolint:wrapcheck
return utils.ToolsRun(tools, fs, Probe,
return tls.Run(tools, fs, Probe,
// Tool found will generate a positive result.
finding.OutcomePositive,
// Tool not found will generate a negative result.

View File

@ -23,7 +23,7 @@ import (
"github.com/ossf/scorecard/v4/checker"
"github.com/ossf/scorecard/v4/finding"
"github.com/ossf/scorecard/v4/probes/internal/utils"
"github.com/ossf/scorecard/v4/probes/internal/utils/uerror"
)
func Test_Run(t *testing.T) {
@ -93,7 +93,7 @@ func Test_Run(t *testing.T) {
},
{
name: "nil raw",
err: utils.ErrNil,
err: uerror.ErrNil,
},
}
for _, tt := range tests {