5
5
"slices"
6
6
"sort"
7
7
"strings"
8
+ "unicode"
9
+ "unicode/utf8"
8
10
9
11
"github.com/fatih/color"
10
12
"github.com/spf13/cobra"
@@ -124,11 +126,21 @@ func printLinters(lcs []*linter.Config) {
124
126
})
125
127
126
128
for _ , lc := range lcs {
129
+ desc := lc .Linter .Desc ()
130
+
127
131
// If the linter description spans multiple lines, truncate everything following the first newline
128
- linterDescription := lc .Linter .Desc ()
129
- firstNewline := strings .IndexRune (linterDescription , '\n' )
130
- if firstNewline > 0 {
131
- linterDescription = linterDescription [:firstNewline ]
132
+ endFirstLine := strings .IndexRune (desc , '\n' )
133
+ if endFirstLine > 0 {
134
+ desc = desc [:endFirstLine ]
135
+ }
136
+
137
+ rawDesc := []rune (desc )
138
+
139
+ r , _ := utf8 .DecodeRuneInString (desc )
140
+ rawDesc [0 ] = unicode .ToUpper (r )
141
+
142
+ if rawDesc [len (rawDesc )- 1 ] != '.' {
143
+ rawDesc = append (rawDesc , '.' )
132
144
}
133
145
134
146
deprecatedMark := ""
@@ -137,6 +149,6 @@ func printLinters(lcs []*linter.Config) {
137
149
}
138
150
139
151
_ , _ = fmt .Fprintf (logutils .StdOut , "%s%s: %s [fast: %t, auto-fix: %t]\n " ,
140
- color .YellowString (lc .Name ()), deprecatedMark , linterDescription , ! lc .IsSlowLinter (), lc .CanAutoFix )
152
+ color .YellowString (lc .Name ()), deprecatedMark , string ( rawDesc ) , ! lc .IsSlowLinter (), lc .CanAutoFix )
141
153
}
142
154
}
0 commit comments