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

Function Inspect

commit/parser.go:26–39  ·  view source on GitHub ↗

Inspect exposes recoverable fields alongside all syntax diagnostics. A nil commit means structural recovery was unsafe.

(input string)

Source from the content-addressed store, hash-verified

24// Inspect exposes recoverable fields alongside all syntax diagnostics.
25// A nil commit means structural recovery was unsafe.
26func Inspect(input string) (Commit, []error) {
27 result := syntax.Inspect(input)
28 var diagnostics []error
29 if len(result.Diagnostics) > 0 {
30 diagnostics = make([]error, len(result.Diagnostics))
31 for i := range diagnostics {
32 diagnostics[i] = &result.Diagnostics[i]
33 }
34 }
35 if !result.Structured {
36 return nil, diagnostics
37 }
38 return &defaultCommit{Commit: result.Commit}, diagnostics
39}
40
41type defaultCommit struct {
42 syntax.Commit

Callers 3

ParseAndLintMethod · 0.92
TestCommitHelpersFunction · 0.92

Calls

no outgoing calls

Tested by 2

TestCommitHelpersFunction · 0.74