mirror of
https://github.com/mgechev/revive.git
synced 2024-11-24 08:32:22 +02:00
Improve the cli formatter
This commit is contained in:
parent
22d1e33541
commit
a227153bc2
@ -2,9 +2,9 @@ severity = "warning"
|
||||
confidence = 0.8
|
||||
|
||||
[rule.else]
|
||||
severity = "error"
|
||||
[rule.names]
|
||||
[rule.argument-limit]
|
||||
arguments = [2]
|
||||
[rule.cyclomatic]
|
||||
arguments = [3]
|
||||
severity = "error"
|
||||
arguments = [3]
|
@ -22,14 +22,13 @@ type CLIFormatter struct {
|
||||
|
||||
func formatFailure(failure lint.Failure, severity lint.Severity) []string {
|
||||
fString := color.BlueString(failure.Failure)
|
||||
fTypeStr := string(severity)
|
||||
fType := color.RedString(fTypeStr)
|
||||
fName := color.RedString(failure.RuleName)
|
||||
lineColumn := failure.Position
|
||||
pos := fmt.Sprintf("(%d, %d)", lineColumn.Start.Line, lineColumn.Start.Column)
|
||||
if severity == lint.SeverityWarning {
|
||||
fType = color.YellowString(fTypeStr)
|
||||
fName = color.YellowString(failure.RuleName)
|
||||
}
|
||||
return []string{failure.GetFilename(), pos, fType, fString}
|
||||
return []string{failure.GetFilename(), pos, fName, fString}
|
||||
}
|
||||
|
||||
// Format formats the failures gotten from the lint.
|
||||
|
Loading…
Reference in New Issue
Block a user