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

Function runLint

internal/cmd/lint.go:39–62  ·  view source on GitHub ↗
(confFilePath, fileInput string)

Source from the content-addressed store, hash-verified

37}
38
39func runLint(confFilePath, fileInput string) (lintResult string, hasError bool, err error) {
40 linter, format, err := getLinter(confFilePath)
41 if err != nil {
42 return "", false, err
43 }
44
45 commitMsg, err := getCommitMsg(fileInput)
46 if err != nil {
47 return "", false, err
48 }
49
50 cleanMsg := cleanupMsg(commitMsg)
51
52 result, err := linter.ParseAndLint(cleanMsg)
53 if err != nil {
54 return "", false, err
55 }
56
57 output, err := format.Format(result)
58 if err != nil {
59 return "", false, err
60 }
61 return output, hasErrorSeverity(result), nil
62}
63
64func getLinter(confParam string) (*lint.Linter, lint.Formatter, error) {
65 conf, err := getConfig(confParam)

Callers 1

lintMsgFunction · 0.85

Calls 6

getLinterFunction · 0.85
getCommitMsgFunction · 0.85
cleanupMsgFunction · 0.85
hasErrorSeverityFunction · 0.85
ParseAndLintMethod · 0.80
FormatMethod · 0.65

Tested by

no test coverage detected