fix(cmd/linters): truncate multiline descriptions (#1663)
This commit is contained in:
parent
6c1c9ccb97
commit
000a815656
@ -45,8 +45,16 @@ func printLinterConfigs(lcs []*linter.Config) {
|
||||
if len(lc.AlternativeNames) != 0 {
|
||||
altNamesStr = fmt.Sprintf(" (%s)", strings.Join(lc.AlternativeNames, ", "))
|
||||
}
|
||||
|
||||
// If the linter description spans multiple lines, truncate everything following the first newline
|
||||
linterDescription := lc.Linter.Desc()
|
||||
firstNewline := strings.IndexRune(linterDescription, '\n')
|
||||
if firstNewline > 0 {
|
||||
linterDescription = linterDescription[:firstNewline]
|
||||
}
|
||||
|
||||
fmt.Fprintf(logutils.StdOut, "%s%s: %s [fast: %t, auto-fix: %t]\n", color.YellowString(lc.Name()),
|
||||
altNamesStr, lc.Linter.Desc(), !lc.IsSlowLinter(), lc.CanAutoFix)
|
||||
altNamesStr, linterDescription, !lc.IsSlowLinter(), lc.CanAutoFix)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user