1
0
Fork 0
forked from forgejo/forgejo

update revive lint to latest commit (#12921)

* update revive lint to latest commit

* make fmt

* change import
This commit is contained in:
techknowlogick 2020-09-22 13:02:16 -04:00 committed by GitHub
parent 63e8bdaf73
commit 1c3278c2fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
154 changed files with 5965 additions and 8502 deletions

View file

@ -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 {