⚠️ Removing the pass field from result (#1853)

- Removing the pass field from result
    - https://github.com/ossf/scorecard/issues/1393

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
This commit is contained in:
naveensrinivasan 2022-04-22 18:33:25 -05:00 committed by Naveen
parent 875b6f694e
commit 2cb654102d
22 changed files with 2 additions and 138 deletions

View File

@ -42,7 +42,6 @@ func TestBinaryArtifacts(t *testing.T) {
err: nil,
expected: checker.CheckResult{
Score: 9,
Pass: true,
},
},
{
@ -51,7 +50,6 @@ func TestBinaryArtifacts(t *testing.T) {
err: nil,
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
}
@ -89,9 +87,6 @@ func TestBinaryArtifacts(t *testing.T) {
if result.Score != tt.expected.Score {
t.Errorf("BinaryArtifacts: %v, expected %v for tests %v", result.Score, tt.expected.Score, tt.name)
}
if result.Pass != tt.expected.Pass {
t.Errorf("BinaryArtifacts: %v, expected %v for tests %v", result.Pass, tt.expected.Pass, tt.name)
}
ctrl.Finish()
})

View File

@ -88,7 +88,6 @@ func TestCodereview(t *testing.T) {
},
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
{
@ -112,7 +111,6 @@ func TestCodereview(t *testing.T) {
},
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
{
@ -136,7 +134,6 @@ func TestCodereview(t *testing.T) {
},
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
{
@ -217,9 +214,6 @@ func TestCodereview(t *testing.T) {
if res.Score != tt.expected.Score {
t.Errorf("Expected score %d, got %d for %v", tt.expected.Score, res.Score, tt.name)
}
if res.Pass != tt.expected.Pass {
t.Errorf("Expected pass %t, got %t for %v", tt.expected.Pass, res.Pass, tt.name)
}
ctrl.Finish()
})
}

View File

@ -134,7 +134,6 @@ func TestContributors(t *testing.T) {
},
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
{
@ -185,9 +184,6 @@ func TestContributors(t *testing.T) {
if res.Score != tt.expected.Score {
t.Errorf("Expected score %d, got %d for %v", tt.expected.Score, res.Score, tt.name)
}
if res.Pass != tt.expected.Pass {
t.Errorf("Expected pass %t, got %t for %v", tt.expected.Pass, res.Pass, tt.name)
}
ctrl.Finish()
})
}

View File

@ -355,9 +355,6 @@ func Test_Maintained(t *testing.T) {
if res.Score != tt.expected.Score {
t.Errorf("Expected score %d, got %d for %v", tt.expected.Score, res.Score, tt.name)
}
if res.Pass != tt.expected.Pass {
t.Errorf("Expected pass %t, got %t for %v", tt.expected.Pass, res.Pass, tt.name)
}
ctrl.Finish()
})
}

View File

@ -53,7 +53,7 @@ func TestSAST(t *testing.T) {
commits: []clients.Commit{},
searchresult: clients.SearchResponse{},
checkRuns: []clients.CheckRun{},
expected: checker.CheckResult{Score: -1, Pass: false},
expected: checker.CheckResult{Score: -1},
},
{
name: "Successful SAST checker should return success status",
@ -76,7 +76,6 @@ func TestSAST(t *testing.T) {
},
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
{
@ -116,7 +115,6 @@ func TestSAST(t *testing.T) {
},
expected: checker.CheckResult{
Score: 7,
Pass: false,
},
},
{
@ -153,7 +151,6 @@ func TestSAST(t *testing.T) {
},
expected: checker.CheckResult{
Score: 0,
Pass: false,
},
},
{
@ -175,7 +172,6 @@ func TestSAST(t *testing.T) {
},
expected: checker.CheckResult{
Score: 0,
Pass: false,
},
},
{
@ -198,7 +194,6 @@ func TestSAST(t *testing.T) {
},
expected: checker.CheckResult{
Score: 0,
Pass: false,
},
},
}
@ -232,9 +227,6 @@ func TestSAST(t *testing.T) {
if res.Score != tt.expected.Score {
t.Errorf("Expected score %d, got %d for %v", tt.expected.Score, res.Score, tt.name)
}
if res.Pass != tt.expected.Pass {
t.Errorf("Expected pass %t, got %t for %v", tt.expected.Pass, res.Pass, tt.name)
}
ctrl.Finish()
})
}

View File

@ -39,7 +39,6 @@ func TestSignedRelease(t *testing.T) {
{
name: "NoReleases",
expected: checker.CheckResult{
Pass: false,
Score: -1,
},
},
@ -54,7 +53,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: false,
Score: -1,
},
},
@ -74,7 +72,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: false,
Score: 0,
},
},
@ -94,7 +91,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
@ -114,7 +110,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
@ -134,7 +129,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
@ -154,7 +148,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
@ -178,7 +171,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
@ -217,7 +209,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
@ -252,7 +243,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: false,
Score: 5,
},
},
@ -351,7 +341,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
@ -359,7 +348,6 @@ func TestSignedRelease(t *testing.T) {
name: "Error getting releases",
err: errors.New("Error getting releases"),
expected: checker.CheckResult{
Pass: false,
Score: -1,
Error: errors.New("Error getting releases"),
},
@ -400,9 +388,6 @@ func TestSignedRelease(t *testing.T) {
if res.Score != tt.expected.Score {
t.Errorf("Expected score %d, got %d for %v", tt.expected.Score, res.Score, tt.name)
}
if res.Pass != tt.expected.Pass {
t.Errorf("Expected pass %t, got %t for %v", tt.expected.Pass, res.Pass, tt.name)
}
ctrl.Finish()
})
}

View File

@ -40,7 +40,6 @@ func TestWebhooks(t *testing.T) {
name: "No Webhooks",
uri: "github.com/owner/repo",
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
err: nil,
@ -50,7 +49,6 @@ func TestWebhooks(t *testing.T) {
name: "With Webhooks and secret set",
uri: "github.com/owner/repo",
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
err: nil,
@ -65,7 +63,6 @@ func TestWebhooks(t *testing.T) {
name: "With Webhooks and no secret set",
uri: "github.com/owner/repo",
expected: checker.CheckResult{
Pass: false,
Score: 0,
},
err: nil,
@ -80,7 +77,6 @@ func TestWebhooks(t *testing.T) {
name: "With 2 Webhooks with and whitout secrets configured",
uri: "github.com/owner/repo",
expected: checker.CheckResult{
Pass: false,
Score: 5,
},
err: nil,
@ -133,9 +129,6 @@ func TestWebhooks(t *testing.T) {
if res.Score != tt.expected.Score {
t.Errorf("Expected score %d, got %d for %v", tt.expected.Score, res.Score, tt.name)
}
if res.Pass != tt.expected.Pass {
t.Errorf("Expected pass %t, got %t for %v", tt.expected.Pass, res.Pass, tt.name)
}
ctrl.Finish()
})
}

View File

@ -97,7 +97,6 @@ func AsJSON(r *pkg.ScorecardResult, showDetails bool, logLevel log.Level, writer
for _, checkResult := range r.Checks {
tmpResult := jsonCheckResult{
Name: checkResult.Name,
Pass: checkResult.Pass,
Confidence: checkResult.Confidence,
}
if showDetails {

View File

@ -79,14 +79,13 @@ var _ = Describe("E2E TEST:"+checks.CheckBinaryArtifacts, func() {
expected := scut.TestReturn{
Error: nil,
Score: checker.MinResultScore,
NumberOfWarn: 24,
NumberOfWarn: 25,
NumberOfInfo: 0,
NumberOfDebug: 0,
}
result := checks.BinaryArtifacts(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "binary artifacts", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
@ -114,9 +113,6 @@ var _ = Describe("E2E TEST:"+checks.CheckBinaryArtifacts, func() {
NumberOfDebug: 0,
}
result := checks.BinaryArtifacts(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "binary artifacts", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())

View File

@ -54,7 +54,6 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() {
result := checks.BranchProtection(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "branch protection accessible", &expected, &result, &dl)).Should(BeTrue())
@ -83,9 +82,6 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() {
NumberOfDebug: 0,
}
result := checks.BranchProtection(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "branch protection accessible", &expected, &result, &dl)).Should(BeTrue())
@ -114,9 +110,6 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() {
NumberOfDebug: 3,
}
result := checks.BranchProtection(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "branch protection accessible", &expected, &result, &dl)).Should(BeTrue())

View File

@ -50,9 +50,6 @@ var _ = Describe("E2E TEST:"+checks.CheckCIIBestPractices, func() {
NumberOfDebug: 0,
}
result := checks.CIIBestPractices(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "passing badge", &expected, &result, &dl)).Should(BeTrue())
})

View File

@ -50,9 +50,6 @@ var _ = Describe("E2E TEST:"+checks.CheckContributors, func() {
NumberOfDebug: 0,
}
result := checks.Contributors(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "several contributors", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())

View File

@ -53,10 +53,6 @@ var _ = Describe("E2E TEST:"+checks.CheckTokenPermissions, func() {
NumberOfDebug: 0,
}
result := checks.DangerousWorkflow(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "dangerous workflow", &expected, &result, &dl)).Should(BeTrue())
})
@ -81,10 +77,6 @@ var _ = Describe("E2E TEST:"+checks.CheckTokenPermissions, func() {
NumberOfDebug: 0,
}
result := checks.DangerousWorkflow(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "dangerous workflow", &expected, &result, &dl)).Should(BeTrue())
})
@ -121,10 +113,6 @@ var _ = Describe("E2E TEST:"+checks.CheckTokenPermissions, func() {
NumberOfDebug: 0,
}
result := checks.DangerousWorkflow(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "dangerous workflow", &expected, &result, &dl)).Should(BeTrue())
})

View File

@ -54,9 +54,6 @@ var _ = Describe("E2E TEST:"+checks.CheckDependencyUpdateTool, func() {
}
result := checks.DependencyUpdateTool(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "dependabot", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
@ -83,9 +80,6 @@ var _ = Describe("E2E TEST:"+checks.CheckDependencyUpdateTool, func() {
NumberOfDebug: 0,
}
result := checks.DependencyUpdateTool(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "renovabot", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())

View File

@ -54,8 +54,6 @@ var _ = Describe("E2E TEST:"+checks.CheckLicense, func() {
}
result := checks.License(&req)
Expect(result.Pass).Should(BeTrue())
Expect(scut.ValidateTestReturn(nil, "license found", &expected, &result,
&dl)).Should(BeTrue())
})
@ -81,8 +79,6 @@ var _ = Describe("E2E TEST:"+checks.CheckLicense, func() {
}
result := checks.License(&req)
Expect(result.Pass).Should(BeTrue())
Expect(scut.ValidateTestReturn(nil, "license found", &expected, &result,
&dl)).Should(BeTrue())
})
@ -120,8 +116,6 @@ var _ = Describe("E2E TEST:"+checks.CheckLicense, func() {
}
result := checks.License(&req)
Expect(result.Pass).Should(BeTrue())
Expect(scut.ValidateTestReturn(nil, "license found", &expected, &result,
&dl)).Should(BeTrue())
})

View File

@ -50,9 +50,6 @@ var _ = Describe("E2E TEST:"+checks.CheckMaintained, func() {
NumberOfDebug: 0,
}
result := checks.Maintained(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "active repo", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())

View File

@ -53,10 +53,6 @@ var _ = Describe("E2E TEST:"+checks.CheckTokenPermissions, func() {
NumberOfDebug: 5,
}
result := checks.TokenPermissions(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "token permissions", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
@ -82,10 +78,6 @@ var _ = Describe("E2E TEST:"+checks.CheckTokenPermissions, func() {
NumberOfDebug: 5,
}
result := checks.TokenPermissions(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "token permissions", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
@ -123,10 +115,6 @@ var _ = Describe("E2E TEST:"+checks.CheckTokenPermissions, func() {
NumberOfDebug: 5,
}
result := checks.TokenPermissions(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "token permissions", &expected, &result, &dl)).Should(BeTrue())
Expect(x.Close()).Should(BeNil())

View File

@ -50,9 +50,6 @@ var _ = Describe("E2E TEST:"+checks.CheckSAST, func() {
NumberOfDebug: 0,
}
result := checks.SAST(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "sast used", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())

View File

@ -54,9 +54,6 @@ var _ = Describe("E2E TEST:"+checks.CheckSecurityPolicy, func() {
NumberOfDebug: 0,
}
result := checks.SecurityPolicy(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "policy found", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
@ -83,9 +80,6 @@ var _ = Describe("E2E TEST:"+checks.CheckSecurityPolicy, func() {
NumberOfDebug: 0,
}
result := checks.SecurityPolicy(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "policy found", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
@ -112,9 +106,6 @@ var _ = Describe("E2E TEST:"+checks.CheckSecurityPolicy, func() {
NumberOfDebug: 0,
}
result := checks.SecurityPolicy(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "policy found", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
@ -141,9 +132,6 @@ var _ = Describe("E2E TEST:"+checks.CheckSecurityPolicy, func() {
NumberOfDebug: 0,
}
result := checks.SecurityPolicy(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "policy found", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
@ -181,9 +169,6 @@ var _ = Describe("E2E TEST:"+checks.CheckSecurityPolicy, func() {
NumberOfDebug: 0,
}
result := checks.SecurityPolicy(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "policy found", &expected, &result, &dl)).Should(BeTrue())
Expect(x.Close()).Should(BeNil())

View File

@ -50,9 +50,6 @@ var _ = Describe("E2E TEST:"+checks.CheckSignedReleases, func() {
NumberOfDebug: 5,
}
result := checks.SignedReleases(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "verified release", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())

View File

@ -53,9 +53,6 @@ var _ = Describe("E2E TEST:"+checks.CheckVulnerabilities, func() {
}
result := checks.Vulnerabilities(&req)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeTrue())
// New version.
Expect(scut.ValidateTestReturn(nil, "no osv vulnerabilities", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
@ -84,9 +81,6 @@ var _ = Describe("E2E TEST:"+checks.CheckVulnerabilities, func() {
NumberOfDebug: 0,
}
result := checks.Vulnerabilities(&checkRequest)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "osv vulnerabilities", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
@ -114,9 +108,6 @@ var _ = Describe("E2E TEST:"+checks.CheckVulnerabilities, func() {
NumberOfDebug: 0,
}
result := checks.Vulnerabilities(&checkRequest)
// UPGRADEv2: to remove.
// Old version.
Expect(result.Pass).Should(BeFalse())
// New version.
Expect(scut.ValidateTestReturn(nil, "osv vulnerabilities", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())

View File

@ -96,7 +96,6 @@ func (r *ScorecardResult) AsJSON(showDetails bool, logLevel log.Level, writer io
for _, checkResult := range r.Checks {
tmpResult := jsonCheckResult{
Name: checkResult.Name,
Pass: checkResult.Pass,
Confidence: checkResult.Confidence,
}
if showDetails {