Skip to content

Commit

Permalink
🐛 Branch-Protection: use debug message when unsure if PRs are required (
Browse files Browse the repository at this point in the history
#3917)

warning when the data isn't available isn't intended.

Signed-off-by: Spencer Schrock <sschrock@google.com>
  • Loading branch information
spencerschrock committed Mar 6, 2024
1 parent e74d90d commit 0a6b06a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
4 changes: 2 additions & 2 deletions checks/branch_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
expected: scut.TestReturn{
Error: nil,
Score: 0,
NumberOfWarn: 6,
NumberOfWarn: 4,
NumberOfInfo: 0,
NumberOfDebug: 8,
NumberOfDebug: 10,
},
nonadmin: true,
defaultBranch: main,
Expand Down
11 changes: 2 additions & 9 deletions checks/evaluation/branch_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,15 +407,8 @@ func adminReviewProtection(f *finding.Finding, doLogging bool, dl checker.Detail
if f.Outcome == finding.OutcomePositive {
score++
}
switch f.Probe {
case requiresLastPushApproval.Probe,
requiresUpToDateBranches.Probe:
logWithDebug(f, doLogging, dl)
if f.Outcome != finding.OutcomeNotAvailable {
max++
}
default:
logInfoOrWarn(f, doLogging, dl)
logWithDebug(f, doLogging, dl)
if f.Outcome != finding.OutcomeNotAvailable {
max++
}
return score, max
Expand Down
4 changes: 2 additions & 2 deletions checks/evaluation/branch_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,9 @@ func TestBranchProtection(t *testing.T) {
},
result: scut.TestReturn{
Score: 3,
NumberOfWarn: 3,
NumberOfWarn: 2,
NumberOfInfo: 2,
NumberOfDebug: 4,
NumberOfDebug: 5,
},
},
{
Expand Down

0 comments on commit 0a6b06a

Please sign in to comment.