diff options
Diffstat (limited to 'vendor/github.com/mgechev/revive/formatter')
-rw-r--r-- | vendor/github.com/mgechev/revive/formatter/friendly.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/vendor/github.com/mgechev/revive/formatter/friendly.go b/vendor/github.com/mgechev/revive/formatter/friendly.go index a543eebe00..d0a3099f8f 100644 --- a/vendor/github.com/mgechev/revive/formatter/friendly.go +++ b/vendor/github.com/mgechev/revive/formatter/friendly.go @@ -10,11 +10,6 @@ import ( "github.com/olekukonko/tablewriter" ) -var ( - errorEmoji = color.RedString("✘") - warningEmoji = color.YellowString("⚠") -) - var newLines = map[rune]bool{ 0x000A: true, 0x000B: true, @@ -25,6 +20,14 @@ var newLines = map[rune]bool{ 0x2029: true, } +func getErrorEmoji() string { + return color.RedString("✘") +} + +func getWarningEmoji() string { + return color.YellowString("⚠") +} + // Friendly is an implementation of the Formatter interface // which formats the errors to JSON. type Friendly struct { @@ -68,9 +71,9 @@ func (f *Friendly) printFriendlyFailure(failure lint.Failure, severity lint.Seve } func (f *Friendly) printHeaderRow(failure lint.Failure, severity lint.Severity) { - emoji := warningEmoji + emoji := getWarningEmoji() if severity == lint.SeverityError { - emoji = errorEmoji + emoji = getErrorEmoji() } fmt.Print(f.table([][]string{{emoji, "https://revive.run/r#" + failure.RuleName, color.GreenString(failure.Failure)}})) } @@ -85,9 +88,9 @@ type statEntry struct { } func (f *Friendly) printSummary(errors, warnings int) { - emoji := warningEmoji + emoji := getWarningEmoji() if errors > 0 { - emoji = errorEmoji + emoji = getErrorEmoji() } problemsLabel := "problems" if errors+warnings == 1 { |