@@ -5,11 +5,11 @@ import (
55 "slices"
66 "sort"
77 "strings"
8+ "unicode"
9+ "unicode/utf8"
810
911 "github.com/fatih/color"
1012 "github.com/spf13/cobra"
11- "golang.org/x/text/cases"
12- "golang.org/x/text/language"
1313
1414 "github.com/golangci/golangci-lint/pkg/config"
1515 "github.com/golangci/golangci-lint/pkg/lint/linter"
@@ -126,16 +126,21 @@ func printLinters(lcs []*linter.Config) {
126126 })
127127
128128 for _ , lc := range lcs {
129+ desc := lc .Linter .Desc ()
130+
129131 // If the linter description spans multiple lines, truncate everything following the first newline
130- linterDescription := lc .Linter .Desc ()
131- firstNewline := strings .IndexRune (linterDescription , '\n' )
132+ firstNewline := strings .IndexRune (desc , '\n' )
132133 if firstNewline > 0 {
133- linterDescription = linterDescription [:firstNewline ]
134+ desc = desc [:firstNewline ]
134135 }
135136
136- // Capitalize the first word of the linter description
137- if firstWord , remaining , ok := strings .Cut (linterDescription , " " ); ok {
138- linterDescription = cases .Title (language .Und , cases .NoLower ).String (firstWord ) + " " + remaining
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 , '.' )
139144 }
140145
141146 deprecatedMark := ""
@@ -144,6 +149,6 @@ func printLinters(lcs []*linter.Config) {
144149 }
145150
146151 _ , _ = fmt .Fprintf (logutils .StdOut , "%s%s: %s [fast: %t, auto-fix: %t]\n " ,
147- color .YellowString (lc .Name ()), deprecatedMark , linterDescription , ! lc .IsSlowLinter (), lc .CanAutoFix )
152+ color .YellowString (lc .Name ()), deprecatedMark , string ( rawDesc ) , ! lc .IsSlowLinter (), lc .CanAutoFix )
148153 }
149154}
0 commit comments