(msg string, issues []*lint.Issue)
| 32 | } |
| 33 | |
| 34 | func (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 | |
| 52 | func (f *DefaultFormatter) writeIssues(w *strings.Builder, sign, title string, issues []*lint.Issue) { |
| 53 | if len(issues) == 0 { |
no test coverage detected