diff options
author | techknowlogick <techknowlogick@gitea.io> | 2020-09-22 13:02:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 20:02:16 +0300 |
commit | 1c3278c2fa7733e61dbca92cbb3e8cd5ce6a848b (patch) | |
tree | ad63d17954e5872de0a82755f2be5f62859d118b /vendor/github.com/mgechev/revive/formatter/friendly.go | |
parent | 63e8bdaf739519c800498dac87b4f362b3c6f478 (diff) | |
download | gitea-1c3278c2fa7733e61dbca92cbb3e8cd5ce6a848b.tar.gz gitea-1c3278c2fa7733e61dbca92cbb3e8cd5ce6a848b.zip |
update revive lint to latest commit (#12921)
* update revive lint to latest commit
* make fmt
* change import
Diffstat (limited to 'vendor/github.com/mgechev/revive/formatter/friendly.go')
-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 { |