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

Method writeFailure

formatter/default.go:34–50  ·  view source on GitHub ↗
(msg string, issues []*lint.Issue)

Source from the content-addressed store, hash-verified

32}
33
34func (f *DefaultFormatter) writeFailure(msg string, issues []*lint.Issue) string {
35 str := &strings.Builder{}
36
37 quotedStr := strconv.Quote(truncate(truncateSize, msg))
38
39 str.WriteString("commitlint\n")
40 str.WriteString("\n→ input: " + quotedStr)
41
42 errs, warns, others := f.bySeverity(issues)
43
44 f.writeIssues(str, "❌", "Errors", errs)
45 f.writeIssues(str, "!", "Warnings", warns)
46 f.writeIssues(str, "?", "Other Severities", others)
47
48 fmt.Fprintf(str, "\n\nTotal %d errors, %d warnings, %d other severities", len(errs), len(warns), len(others))
49 return strings.Trim(str.String(), "\n")
50}
51
52func (f *DefaultFormatter) writeIssues(w *strings.Builder, sign, title string, issues []*lint.Issue) {
53 if len(issues) == 0 {

Callers 1

formatFailureMethod · 0.95

Calls 4

bySeverityMethod · 0.95
writeIssuesMethod · 0.95
truncateFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected