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