mirror of
https://github.com/ossf/scorecard.git
synced 2024-09-11 08:55:27 +03:00
debug failing tests
Signed-off-by: Adam Korczynski <adam@adalogics.com>
This commit is contained in:
parent
2d26086d74
commit
00acf66ea6
@ -174,7 +174,7 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
|
||||
Error: nil,
|
||||
Score: 4,
|
||||
NumberOfWarn: 9,
|
||||
NumberOfInfo: 11,
|
||||
NumberOfInfo: 12,
|
||||
NumberOfDebug: 0,
|
||||
},
|
||||
defaultBranch: main,
|
||||
@ -232,7 +232,7 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
|
||||
Error: nil,
|
||||
Score: 8,
|
||||
NumberOfWarn: 4,
|
||||
NumberOfInfo: 16,
|
||||
NumberOfInfo: 18,
|
||||
NumberOfDebug: 0,
|
||||
},
|
||||
defaultBranch: main,
|
||||
|
@ -454,7 +454,11 @@ func codeownerBranchProtection(f *finding.Finding, doLogging bool, dl checker.De
|
||||
var score, max int
|
||||
if f.Outcome == finding.OutcomePositive {
|
||||
info(dl, doLogging, f.Message)
|
||||
score++
|
||||
if f.Values["CodeownersFiles"] == 0 {
|
||||
warn(dl, doLogging, "codeowners branch protection is being ignored - but no codeowners file found in repo")
|
||||
} else {
|
||||
score++
|
||||
}
|
||||
} else {
|
||||
warn(dl, doLogging, f.Message)
|
||||
}
|
||||
|
@ -521,7 +521,8 @@ func TestBranchProtection(t *testing.T) {
|
||||
Probe: "requiresCodeOwnersReview",
|
||||
Outcome: finding.OutcomePositive,
|
||||
Values: map[string]int{
|
||||
"main": 1,
|
||||
"main": 1,
|
||||
"CodeownersFiles": 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -1227,7 +1228,8 @@ func TestBranchProtection(t *testing.T) {
|
||||
Probe: "requiresCodeOwnersReview",
|
||||
Outcome: finding.OutcomePositive,
|
||||
Values: map[string]int{
|
||||
"main": 1,
|
||||
"main": 1,
|
||||
"CodeownersFiles": 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -1315,7 +1317,8 @@ func TestBranchProtection(t *testing.T) {
|
||||
Probe: "requiresCodeOwnersReview",
|
||||
Outcome: finding.OutcomePositive,
|
||||
Values: map[string]int{
|
||||
"main": 1,
|
||||
"main": 1,
|
||||
"CodeownersFiles": 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -1403,7 +1406,8 @@ func TestBranchProtection(t *testing.T) {
|
||||
Probe: "requiresCodeOwnersReview",
|
||||
Outcome: finding.OutcomePositive,
|
||||
Values: map[string]int{
|
||||
"main": 1,
|
||||
"main": 1,
|
||||
"CodeownersFiles": 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -1481,7 +1485,8 @@ func TestBranchProtection(t *testing.T) {
|
||||
Probe: "requiresCodeOwnersReview",
|
||||
Outcome: finding.OutcomePositive,
|
||||
Values: map[string]int{
|
||||
"main2": 1,
|
||||
"main2": 1,
|
||||
"CodeownersFiles": 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -63,9 +63,6 @@ func Run(raw *checker.RawResults) ([]finding.Finding, string, error) {
|
||||
case !*reqOwnerReviews:
|
||||
text = fmt.Sprintf("codeowners review is not required on branch '%s'", *branch.Name)
|
||||
outcome = finding.OutcomeNegative
|
||||
case len(r.CodeownersFiles) == 0:
|
||||
text = "codeowners review is required - but no codeowners file found in repo"
|
||||
outcome = finding.OutcomeNegative
|
||||
default:
|
||||
text = fmt.Sprintf("codeowner review is required on branch '%s'", *branch.Name)
|
||||
outcome = finding.OutcomePositive
|
||||
|
Loading…
Reference in New Issue
Block a user