Skip to content

Commit 4b090e1

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

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ require (
131131
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
132132
golang.org/x/mod v0.22.0
133133
golang.org/x/sys v0.28.0
134+
golang.org/x/text v0.20.0
134135
golang.org/x/tools v0.28.0
135136
gopkg.in/yaml.v3 v3.0.1
136137
honnef.co/go/tools v0.5.1
@@ -199,7 +200,6 @@ require (
199200
go.uber.org/zap v1.24.0 // indirect
200201
golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect
201202
golang.org/x/sync v0.10.0 // indirect
202-
golang.org/x/text v0.20.0 // indirect
203203
google.golang.org/protobuf v1.34.2 // indirect
204204
gopkg.in/ini.v1 v1.67.0 // indirect
205205
gopkg.in/yaml.v2 v2.4.0 // indirect

pkg/commands/help.go

Lines changed: 7 additions & 0 deletions
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)