diff --git a/checks/security_policy.go b/checks/security_policy.go index e0a05d59..a7e92f62 100644 --- a/checks/security_policy.go +++ b/checks/security_policy.go @@ -15,12 +15,14 @@ package checks import ( + "errors" "strings" "go.uber.org/zap" "github.com/ossf/scorecard/v3/checker" "github.com/ossf/scorecard/v3/clients/githubrepo" + sce "github.com/ossf/scorecard/v3/errors" ) // CheckSecurityPolicy is the registred name for SecurityPolicy. @@ -72,9 +74,6 @@ func SecurityPolicy(c *checker.CheckRequest) checker.CheckResult { return checker.CreateMaxScoreResult(CheckSecurityPolicy, "security policy file detected") } - // I'm not sure what exactly the following code is supposed to do. It seems to always fail with - // Warn: repo unreachable: GET https://api.github.com/repos/systemd/.github: 404 Not Found [] - // https://docs.github.com/en/github/building-a-strong-community/creating-a-default-community-health-file. logger, err := githubrepo.NewLogger(zap.InfoLevel) if err != nil { @@ -115,7 +114,8 @@ func SecurityPolicy(c *checker.CheckRequest) checker.CheckResult { if r { return checker.CreateMaxScoreResult(CheckSecurityPolicy, "security policy file detected") } - // err != nil + case errors.Is(err, sce.ErrRepoUnreachable): + break default: return checker.CreateRuntimeErrorResult(CheckSecurityPolicy, err) }