Skip to content

Commit a6fae58

Browse files
committed
fix: move ShowStats field
1 parent a087808 commit a6fae58

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

.golangci.reference.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ run:
8080
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17
8181
go: '1.19'
8282

83-
# Show statistics per linter.
84-
# Default: false
85-
show-stats: true
86-
8783

8884
# output configuration options
8985
output:
@@ -117,6 +113,9 @@ output:
117113
# Default: false
118114
sort-results: true
119115

116+
# Show statistics per linter.
117+
# Default: false
118+
show-stats: true
120119

121120
# All available settings of specific linters.
122121
linters-settings:

pkg/commands/flagsets.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ func setupRunFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
5555
const allowSerialDesc = "Allow multiple golangci-lint instances running, but serialize them around a lock. " +
5656
"If false (default) - golangci-lint exits with an error if it fails to acquire file lock on start."
5757
internal.AddFlagAndBind(v, fs, fs.Bool, "allow-serial-runners", "run.allow-serial-runners", false, color.GreenString(allowSerialDesc))
58-
internal.AddFlagAndBind(v, fs, fs.Bool, "show-stats", "run.show-stats", false, color.GreenString("Show statistics per linter"))
5958
}
6059

6160
func setupOutputFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
@@ -71,6 +70,7 @@ func setupOutputFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
7170
color.GreenString("Sort linter results"))
7271
internal.AddFlagAndBind(v, fs, fs.String, "path-prefix", "output.path-prefix", "",
7372
color.GreenString("Path prefix to add to output"))
73+
internal.AddFlagAndBind(v, fs, fs.Bool, "show-stats", "output.show-stats", false, color.GreenString("Show statistics per linter"))
7474
}
7575

7676
//nolint:gomnd

pkg/commands/run.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,11 @@ func (c *runCommand) setExitCodeIfIssuesFound(issues []result.Issue) {
397397
}
398398

399399
func (c *runCommand) printStats(issues []result.Issue) {
400-
if !c.cfg.Run.ShowStats {
400+
if c.cfg.Run.ShowStats {
401+
c.log.Warnf("run.show-stats is deprecated, please use output.show-stats")
402+
}
403+
404+
if !c.cfg.Run.ShowStats && !c.cfg.Output.ShowStats {
401405
return
402406
}
403407

pkg/config/output.go

+1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ type Output struct {
3434
UniqByLine bool `mapstructure:"uniq-by-line"`
3535
SortResults bool `mapstructure:"sort-results"`
3636
PathPrefix string `mapstructure:"path-prefix"`
37+
ShowStats bool `mapstructure:"show-stats"`
3738
}

pkg/config/run.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Run struct {
2323
AllowParallelRunners bool `mapstructure:"allow-parallel-runners"`
2424
AllowSerialRunners bool `mapstructure:"allow-serial-runners"`
2525

26-
ShowStats bool `mapstructure:"show-stats"`
26+
ShowStats bool `mapstructure:"show-stats"` // Deprecated use Output.ShowStats instead.
2727

2828
// It's obtain by flags and use for the tests and the context loader.
2929
Args []string // Internal needs.

0 commit comments

Comments
 (0)