MCPcopy
hub / github.com/ossf/scorecard / BranchProtection

Function BranchProtection

checks/branch_protection.go:38–60  ·  view source on GitHub ↗

BranchProtection runs the Branch-Protection check.

(c *checker.CheckRequest)

Source from the content-addressed store, hash-verified

36
37// BranchProtection runs the Branch-Protection check.
38func BranchProtection(c *checker.CheckRequest) checker.CheckResult {
39 rawData, err := raw.BranchProtection(c)
40 if err != nil {
41 e := sce.WithMessage(sce.ErrScorecardInternal, err.Error())
42 return checker.CreateRuntimeErrorResult(CheckBranchProtection, e)
43 }
44
45 // Set the raw results.
46 pRawResults := getRawResults(c)
47 pRawResults.BranchProtectionResults = rawData
48
49 // Evaluate the probes.
50 findings, err := zrunner.Run(pRawResults, probes.BranchProtection)
51 if err != nil {
52 e := sce.WithMessage(sce.ErrScorecardInternal, err.Error())
53 return checker.CreateRuntimeErrorResult(CheckBranchProtection, e)
54 }
55
56 // Return the score evaluation.
57 ret := evaluation.BranchProtection(CheckBranchProtection, findings, c.Dlogger)
58 ret.Findings = findings
59 return ret
60}

Calls 7

BranchProtectionFunction · 0.92
CreateRuntimeErrorResultFunction · 0.92
RunFunction · 0.92
BranchProtectionFunction · 0.92
getRawResultsFunction · 0.85
WithMessageMethod · 0.80
ErrorMethod · 0.45

Tested by 1