Skip to content

Commit 3ebb1ce

Browse files
committed
dev: capitalize the first word of the linter description
1 parent 59f05b5 commit 3ebb1ce

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/commands/help.go

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88

99
"github.com/fatih/color"
1010
"github.com/spf13/cobra"
11+
"golang.org/x/text/cases"
12+
"golang.org/x/text/language"
1113

1214
"github.com/golangci/golangci-lint/pkg/config"
1315
"github.com/golangci/golangci-lint/pkg/lint/linter"
@@ -131,6 +133,11 @@ func printLinters(lcs []*linter.Config) {
131133
linterDescription = linterDescription[:firstNewline]
132134
}
133135

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
139+
}
140+
134141
deprecatedMark := ""
135142
if lc.IsDeprecated() {
136143
deprecatedMark = " [" + color.RedString("deprecated") + "]"

0 commit comments

Comments
 (0)