| 43 | |
| 44 | func (r *TrailerExistsRule) Name() string { return "trailer-exists" } |
| 45 | func (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 | |
| 55 | func (r *TrailerExistsRule) Validate(msg lint.Commit) (*lint.Issue, bool) { |
| 56 | if hasTrailer(msg, r.Value) { |