Skip to content

Commit

Permalink
⚠️ Removing the pass field from result (#1853)
Browse files Browse the repository at this point in the history
    - Removing the pass field from result
    - #1393

Signed-off-by: naveensrinivasan <[email protected]>
  • Loading branch information
naveensrinivasan committed May 3, 2022
1 parent 875b6f6 commit 2cb6541
Show file tree
Hide file tree
Showing 22 changed files with 2 additions and 138 deletions.
5 changes: 0 additions & 5 deletions checks/binary_artifact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func TestBinaryArtifacts(t *testing.T) {
err: nil,
expected: checker.CheckResult{
Score: 9,
Pass: true,
},
},
{
Expand All @@ -51,7 +50,6 @@ func TestBinaryArtifacts(t *testing.T) {
err: nil,
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
}
Expand Down Expand Up @@ -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()
})
Expand Down
6 changes: 0 additions & 6 deletions checks/code_review_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func TestCodereview(t *testing.T) {
},
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
{
Expand All @@ -112,7 +111,6 @@ func TestCodereview(t *testing.T) {
},
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
{
Expand All @@ -136,7 +134,6 @@ func TestCodereview(t *testing.T) {
},
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
{
Expand Down Expand Up @@ -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()
})
}
Expand Down
4 changes: 0 additions & 4 deletions checks/contributors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func TestContributors(t *testing.T) {
},
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
{
Expand Down Expand Up @@ -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()
})
}
Expand Down
3 changes: 0 additions & 3 deletions checks/maintained_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
}
Expand Down
10 changes: 1 addition & 9 deletions checks/sast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -76,7 +76,6 @@ func TestSAST(t *testing.T) {
},
expected: checker.CheckResult{
Score: 10,
Pass: true,
},
},
{
Expand Down Expand Up @@ -116,7 +115,6 @@ func TestSAST(t *testing.T) {
},
expected: checker.CheckResult{
Score: 7,
Pass: false,
},
},
{
Expand Down Expand Up @@ -153,7 +151,6 @@ func TestSAST(t *testing.T) {
},
expected: checker.CheckResult{
Score: 0,
Pass: false,
},
},
{
Expand All @@ -175,7 +172,6 @@ func TestSAST(t *testing.T) {
},
expected: checker.CheckResult{
Score: 0,
Pass: false,
},
},
{
Expand All @@ -198,7 +194,6 @@ func TestSAST(t *testing.T) {
},
expected: checker.CheckResult{
Score: 0,
Pass: false,
},
},
}
Expand Down Expand Up @@ -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()
})
}
Expand Down
15 changes: 0 additions & 15 deletions checks/signed_releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func TestSignedRelease(t *testing.T) {
{
name: "NoReleases",
expected: checker.CheckResult{
Pass: false,
Score: -1,
},
},
Expand All @@ -54,7 +53,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: false,
Score: -1,
},
},
Expand All @@ -74,7 +72,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: false,
Score: 0,
},
},
Expand All @@ -94,7 +91,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
Expand All @@ -114,7 +110,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
Expand All @@ -134,7 +129,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
Expand All @@ -154,7 +148,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
Expand All @@ -178,7 +171,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
Expand Down Expand Up @@ -217,7 +209,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
Expand Down Expand Up @@ -252,7 +243,6 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: false,
Score: 5,
},
},
Expand Down Expand Up @@ -351,15 +341,13 @@ func TestSignedRelease(t *testing.T) {
},
},
expected: checker.CheckResult{
Pass: true,
Score: 10,
},
},
{
name: "Error getting releases",
err: errors.New("Error getting releases"),
expected: checker.CheckResult{
Pass: false,
Score: -1,
Error: errors.New("Error getting releases"),
},
Expand Down Expand Up @@ -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()
})
}
Expand Down
7 changes: 0 additions & 7 deletions checks/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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()
})
}
Expand Down
1 change: 0 additions & 1 deletion cron/format/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 1 addition & 5 deletions e2e/binary_artifacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
7 changes: 0 additions & 7 deletions e2e/branch_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
3 changes: 0 additions & 3 deletions e2e/cii_best_practices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
Expand Down
3 changes: 0 additions & 3 deletions e2e/contributors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Loading

0 comments on commit 2cb6541

Please sign in to comment.