MCPcopy Index your code
hub / github.com/conventionalcommit/commitlint / Validate

Method Validate

rule/type_enum.go:32–39  ·  view source on GitHub ↗

Validate validates TypeEnumRule

(msg lint.Commit)

Source from the content-addressed store, hash-verified

30
31// Validate validates TypeEnumRule
32func (r *TypeEnumRule) Validate(msg lint.Commit) (*lint.Issue, bool) {
33 isFound := search(r.Types, msg.Type())
34 if isFound {
35 return nil, true
36 }
37 desc := fmt.Sprintf("type '%s' is not allowed, you can use one of %v", msg.Type(), r.Types)
38 return lint.NewIssue(desc), false
39}

Callers 2

TestTypeEnum_ValidTypesFunction · 0.95
TestTypeEnum_InvalidFunction · 0.95

Calls 3

NewIssueFunction · 0.92
searchFunction · 0.85
TypeMethod · 0.65

Tested by 2

TestTypeEnum_ValidTypesFunction · 0.76
TestTypeEnum_InvalidFunction · 0.76