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

Method Apply

lint/rule/trailer_rules.go:45–53  ·  view source on GitHub ↗
(s lint.RuleSetting)

Source from the content-addressed store, hash-verified

43
44func (r *TrailerExistsRule) Name() string { return "trailer-exists" }
45func (r *TrailerExistsRule) Apply(s lint.RuleSetting) error {
46 if err := applyStringArg(&r.Value, r.Name(), s); err != nil {
47 return err
48 }
49 // Normalize: strip a trailing ":" so both "Co-authored-by:" and
50 // "Co-authored-by" match note tokens returned by the parser.
51 r.Value = strings.TrimSuffix(strings.TrimSpace(r.Value), ":")
52 return nil
53}
54
55func (r *TrailerExistsRule) Validate(msg lint.Commit) (*lint.Issue, bool) {
56 if hasTrailer(msg, r.Value) {

Callers 2

Calls 2

NameMethod · 0.95
applyStringArgFunction · 0.85

Tested by 2