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

Method Parse

test/syntax_parser_test.go:101–118  ·  view source on GitHub ↗
(msg string)

Source from the content-addressed store, hash-verified

99type customParser struct{}
100
101func (p *customParser) Parse(msg string) (commit.Commit, error) {
102 if msg == "bad" {
103 return nil, errors.New("custom parse failure")
104 }
105 header, rest, _ := strings.Cut(msg, "\n\n")
106 typ, desc, _ := strings.Cut(header, ": ")
107 c := &mockCommit{
108 message: msg,
109 header: header,
110 body: rest,
111 typ: typ,
112 description: desc,
113 }
114 if strings.HasPrefix(msg, "warn:") {
115 return c, errors.New("recoverable custom error")
116 }
117 return c, nil
118}
119
120func TestCustomParserIntegration(t *testing.T) {
121 conf := config.NewDefault()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected