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

Method Validate

rule/leading_blank_rules.go:50–65  ·  view source on GitHub ↗
(msg lint.Commit)

Source from the content-addressed store, hash-verified

48func (r *FooterLeadingBlankRule) Name() string { return "footer-leading-blank" }
49func (r *FooterLeadingBlankRule) Apply(_ lint.RuleSetting) error { return nil }
50func (r *FooterLeadingBlankRule) Validate(msg lint.Commit) (*lint.Issue, bool) {
51 footer := msg.Footer()
52 if footer == "" {
53 return nil, true
54 }
55 raw := msg.Message()
56 // Footer should be preceded by "\n\n"
57 footerIdx := strings.LastIndex(raw, footer)
58 if footerIdx < 2 {
59 return lint.NewIssue("footer must have a leading blank line"), false
60 }
61 if raw[footerIdx-2:footerIdx] == "\n\n" {
62 return nil, true
63 }
64 return lint.NewIssue("footer must have a leading blank line"), false
65}

Calls 3

NewIssueFunction · 0.92
FooterMethod · 0.65
MessageMethod · 0.65