Skip to content

Commit 97987f9

Browse files
alexandearldez
andauthored
dev: enhance help linters output on fast and auto-fix capabilities (#5207)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 127edc0 commit 97987f9

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

pkg/commands/help.go

+15-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,20 @@ func printLinters(lcs []*linter.Config) {
148148
deprecatedMark = " [" + color.RedString("deprecated") + "]"
149149
}
150150

151-
_, _ = fmt.Fprintf(logutils.StdOut, "%s%s: %s [fast: %t, auto-fix: %t]\n",
152-
color.YellowString(lc.Name()), deprecatedMark, string(rawDesc), !lc.IsSlowLinter(), lc.CanAutoFix)
151+
var capabilities []string
152+
if !lc.IsSlowLinter() {
153+
capabilities = append(capabilities, color.BlueString("fast"))
154+
}
155+
if lc.CanAutoFix {
156+
capabilities = append(capabilities, color.GreenString("auto-fix"))
157+
}
158+
159+
var capability string
160+
if capabilities != nil {
161+
capability = " [" + strings.Join(capabilities, ", ") + "]"
162+
}
163+
164+
_, _ = fmt.Fprintf(logutils.StdOut, "%s%s: %s%s\n",
165+
color.YellowString(lc.Name()), deprecatedMark, string(rawDesc), capability)
153166
}
154167
}

0 commit comments

Comments
 (0)