fix: move show-stats field from run to output (#4439)
This commit is contained in:
parent
a0878087fa
commit
8f2459bf0e
@ -80,10 +80,6 @@ run:
|
||||
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17
|
||||
go: '1.19'
|
||||
|
||||
# Show statistics per linter.
|
||||
# Default: false
|
||||
show-stats: true
|
||||
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
@ -117,6 +113,9 @@ output:
|
||||
# Default: false
|
||||
sort-results: true
|
||||
|
||||
# Show statistics per linter.
|
||||
# Default: false
|
||||
show-stats: true
|
||||
|
||||
# All available settings of specific linters.
|
||||
linters-settings:
|
||||
|
@ -138,19 +138,30 @@ issues:
|
||||
- gomnd
|
||||
|
||||
- path: pkg/golinters/errcheck.go
|
||||
linters: [staticcheck]
|
||||
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
|
||||
- path: pkg/commands/run.go
|
||||
linters: [staticcheck]
|
||||
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"
|
||||
- path: pkg/commands/run.go
|
||||
linters: [staticcheck]
|
||||
text: "SA1019: c.cfg.Run.ShowStats is deprecated: use Output.ShowStats instead."
|
||||
|
||||
- path: pkg/golinters/gofumpt.go
|
||||
linters: [staticcheck]
|
||||
text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead."
|
||||
- path: pkg/golinters/staticcheck_common.go
|
||||
linters: [staticcheck]
|
||||
text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead."
|
||||
- path: pkg/lint/lintersdb/manager.go
|
||||
linters: [staticcheck]
|
||||
text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead."
|
||||
|
||||
- path: pkg/golinters/unused.go
|
||||
linters: [gocritic]
|
||||
text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)"
|
||||
- path: test/(fix|linters)_test.go
|
||||
linters: [gocritic]
|
||||
text: "string `gocritic.go` has 3 occurrences, make it a constant"
|
||||
|
||||
run:
|
||||
|
@ -55,7 +55,6 @@ func setupRunFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
|
||||
const allowSerialDesc = "Allow multiple golangci-lint instances running, but serialize them around a lock. " +
|
||||
"If false (default) - golangci-lint exits with an error if it fails to acquire file lock on start."
|
||||
internal.AddFlagAndBind(v, fs, fs.Bool, "allow-serial-runners", "run.allow-serial-runners", false, color.GreenString(allowSerialDesc))
|
||||
internal.AddFlagAndBind(v, fs, fs.Bool, "show-stats", "run.show-stats", false, color.GreenString("Show statistics per linter"))
|
||||
}
|
||||
|
||||
func setupOutputFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
|
||||
@ -71,6 +70,7 @@ func setupOutputFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
|
||||
color.GreenString("Sort linter results"))
|
||||
internal.AddFlagAndBind(v, fs, fs.String, "path-prefix", "output.path-prefix", "",
|
||||
color.GreenString("Path prefix to add to output"))
|
||||
internal.AddFlagAndBind(v, fs, fs.Bool, "show-stats", "output.show-stats", false, color.GreenString("Show statistics per linter"))
|
||||
}
|
||||
|
||||
//nolint:gomnd
|
||||
|
@ -397,7 +397,11 @@ func (c *runCommand) setExitCodeIfIssuesFound(issues []result.Issue) {
|
||||
}
|
||||
|
||||
func (c *runCommand) printStats(issues []result.Issue) {
|
||||
if !c.cfg.Run.ShowStats {
|
||||
if c.cfg.Run.ShowStats {
|
||||
c.log.Warnf("The configuration option `run.show-stats` is deprecated, please use `output.show-stats`")
|
||||
}
|
||||
|
||||
if !c.cfg.Run.ShowStats && !c.cfg.Output.ShowStats {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -34,4 +34,5 @@ type Output struct {
|
||||
UniqByLine bool `mapstructure:"uniq-by-line"`
|
||||
SortResults bool `mapstructure:"sort-results"`
|
||||
PathPrefix string `mapstructure:"path-prefix"`
|
||||
ShowStats bool `mapstructure:"show-stats"`
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ type Run struct {
|
||||
AllowParallelRunners bool `mapstructure:"allow-parallel-runners"`
|
||||
AllowSerialRunners bool `mapstructure:"allow-serial-runners"`
|
||||
|
||||
// Deprecated: use Output.ShowStats instead.
|
||||
ShowStats bool `mapstructure:"show-stats"`
|
||||
|
||||
// It's obtain by flags and use for the tests and the context loader.
|
||||
|
Loading…
x
Reference in New Issue
Block a user