MCPcopy Create free account
hub / github.com/conventionalcommit/commitlint / Apply

Method Apply

lint/rule/type_enum.go:21–29  ·  view source on GitHub ↗

Apply sets the needed argument for the rule

(setting lint.RuleSetting)

Source from the content-addressed store, hash-verified

19
20// Apply sets the needed argument for the rule
21func (r *TypeEnumRule) Apply(setting lint.RuleSetting) error {
22 err := setStringArrArg(&r.Types, setting.Argument)
23 if err != nil {
24 return errInvalidArg(r.Name(), err)
25 }
26 // sorting the string elements for binary search
27 sort.Strings(r.Types)
28 return nil
29}
30
31// Validate validates TypeEnumRule
32func (r *TypeEnumRule) Validate(msg lint.Commit) (*lint.Issue, bool) {

Callers 3

TestTypeEnum_ValidTypesFunction · 0.95
TestTypeEnum_InvalidFunction · 0.95
TestTypeEnum_BadArgFunction · 0.95

Calls 3

NameMethod · 0.95
setStringArrArgFunction · 0.85
errInvalidArgFunction · 0.85

Tested by 3

TestTypeEnum_ValidTypesFunction · 0.76
TestTypeEnum_InvalidFunction · 0.76
TestTypeEnum_BadArgFunction · 0.76