MCPcopy
hub / github.com/zegl/kube-score / Add

Method Add

scorecard/scorecard.go:94–115  ·  view source on GitHub ↗
(ts TestScore, check ks.Check, locationer ks.FileLocationer, annotations ...map[string]string)

Source from the content-addressed store, hash-verified

92}
93
94func (so *ScoredObject) Add(ts TestScore, check ks.Check, locationer ks.FileLocationer, annotations ...map[string]string) {
95 ts.Check = check
96 so.FileLocation = locationer.FileLocation()
97
98 var skip bool
99 if annotations != nil {
100 if len(annotations) == 1 && !so.isEnabled(check, annotations[0], nil) {
101 skip = true
102 }
103 if len(annotations) == 2 && !so.isEnabled(check, annotations[0], annotations[1]) {
104 skip = true
105 }
106 }
107
108 // This test is ignored (via annotations), don't save the score
109 if skip {
110 ts.Skipped = true
111 ts.Comments = []TestScoreComment{{Summary: fmt.Sprintf("Skipped because %s is ignored", check.ID)}}
112 }
113
114 so.Checks = append(so.Checks, ts)
115}
116
117type TestScore struct {
118 Check ks.Check

Callers 1

ScoreFunction · 0.80

Calls 2

isEnabledMethod · 0.95
FileLocationMethod · 0.65

Tested by

no test coverage detected