diff --git a/config.toml b/config.toml index 0afb8e6..25325ac 100644 --- a/config.toml +++ b/config.toml @@ -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" \ No newline at end of file + arguments = [3] \ No newline at end of file diff --git a/formatter/cli_formatter.go b/formatter/cli_formatter.go index a51959f..0f97797 100644 --- a/formatter/cli_formatter.go +++ b/formatter/cli_formatter.go @@ -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. diff --git a/main.go b/main.go index 72420f3..0ef88c1 100644 --- a/main.go +++ b/main.go @@ -98,6 +98,7 @@ func main() { src := ` package p + // revive:disable:cyclomatic func Test() { if true || bar && baz { return 42; @@ -105,6 +106,7 @@ func main() { return 23; } } + // revive:enable:cyclomatic func foo_bar(a int, b int, c int, d int) { return a + b + c;