Skip to content

Commit

Permalink
Fix Github checks
Browse files Browse the repository at this point in the history
* Fix lint issues for `range` operator
* Fix e2e test failure
  • Loading branch information
raghavkaul committed Jul 14, 2022
1 parent 09f0eed commit 6a16492
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
24 changes: 16 additions & 8 deletions checks/evaluation/branch_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,63 +108,71 @@ func BranchProtection(name string, dl checker.DetailLogger,

func computeNonAdminBasicScore(scores []levelScore) int {
score := 0
for _, s := range scores {
for i := range scores {
s := scores[i]
score += s.scores.basic
}
return score
}

func computeAdminBasicScore(scores []levelScore) int {
score := 0
for _, s := range scores {
for i := range scores {
s := scores[i]
score += s.scores.adminBasic
}
return score
}

func computeNonAdminReviewScore(scores []levelScore) int {
score := 0
for _, s := range scores {
for i := range scores {
s := scores[i]
score += s.scores.review
}
return score
}

func computeAdminReviewScore(scores []levelScore) int {
score := 0
for _, s := range scores {
for i := range scores {
s := scores[i]
score += s.scores.adminReview
}
return score
}

func computeNonAdminThoroughReviewScore(scores []levelScore) int {
score := 0
for _, s := range scores {
for i := range scores {
s := scores[i]
score += s.scores.thoroughReview
}
return score
}

func computeAdminThoroughReviewScore(scores []levelScore) int {
score := 0
for _, s := range scores {
for i := range scores {
s := scores[i]
score += s.scores.adminThoroughReview
}
return score
}

func computeNonAdminContextScore(scores []levelScore) int {
score := 0
for _, s := range scores {
for i := range scores {
s := scores[i]
score += s.scores.context
}
return score
}

func computeCodeownerThoroughReviewScore(scores []levelScore) int {
score := 0
for _, s := range scores {
for i := range scores {
s := scores[i]
score += s.scores.codeownerReview
}
return score
Expand Down
4 changes: 2 additions & 2 deletions e2e/branch_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() {
Error: nil,
Score: 6,
NumberOfWarn: 1,
NumberOfInfo: 3,
NumberOfInfo: 4,
NumberOfDebug: 3,
}
result := checks.BranchProtection(&req)
Expand Down Expand Up @@ -105,7 +105,7 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() {
expected := scut.TestReturn{
Error: nil,
Score: 1,
NumberOfWarn: 2,
NumberOfWarn: 3,
NumberOfInfo: 3,
NumberOfDebug: 3,
}
Expand Down

0 comments on commit 6a16492

Please sign in to comment.