From 971e64d68c9f9dfe1d34fc7e1bf4fc7781f7a2bf Mon Sep 17 00:00:00 2001 From: Spencer Schrock Date: Wed, 6 Mar 2024 13:10:23 -0800 Subject: [PATCH] :bug: Branch-Protection: use debug message when unsure if PRs are required (#3917) warning when the data isn't available isn't intended. Signed-off-by: Spencer Schrock --- checks/branch_protection_test.go | 4 ++-- checks/evaluation/branch_protection.go | 11 ++--------- checks/evaluation/branch_protection_test.go | 4 ++-- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/checks/branch_protection_test.go b/checks/branch_protection_test.go index d0c6f087fcdb..3e55e834cbd3 100644 --- a/checks/branch_protection_test.go +++ b/checks/branch_protection_test.go @@ -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, diff --git a/checks/evaluation/branch_protection.go b/checks/evaluation/branch_protection.go index 4177d0061f06..5e72958addd8 100644 --- a/checks/evaluation/branch_protection.go +++ b/checks/evaluation/branch_protection.go @@ -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 diff --git a/checks/evaluation/branch_protection_test.go b/checks/evaluation/branch_protection_test.go index f19714145eb9..c0e0565b9554 100644 --- a/checks/evaluation/branch_protection_test.go +++ b/checks/evaluation/branch_protection_test.go @@ -731,9 +731,9 @@ func TestBranchProtection(t *testing.T) { }, result: scut.TestReturn{ Score: 3, - NumberOfWarn: 3, + NumberOfWarn: 2, NumberOfInfo: 2, - NumberOfDebug: 4, + NumberOfDebug: 5, }, }, {