Skip to content

Commit a2b6412

Browse files
authored
chore: apply same default limitations on all formatters (#5474)
1 parent 7892153 commit a2b6412

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

Diff for: .golangci.yml

-22
Original file line numberDiff line numberDiff line change
@@ -72,28 +72,6 @@ linters:
7272
- mnd
7373
- lll
7474

75-
# Deprecated linter options.
76-
- path: pkg/golinters/errcheck/errcheck.go
77-
linters: [staticcheck]
78-
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
79-
- path: pkg/golinters/errcheck/errcheck.go
80-
linters: [staticcheck]
81-
text: "SA1019: errCfg.Ignore is deprecated: use ExcludeFunctions instead"
82-
- path: pkg/golinters/govet/govet.go
83-
linters: [staticcheck]
84-
text: "SA1019: cfg.CheckShadowing is deprecated: the linter should be enabled inside Enable."
85-
- path: pkg/golinters/godot/godot.go
86-
linters: [staticcheck]
87-
text: "SA1019: settings.CheckAll is deprecated: use Scope instead"
88-
- path: pkg/goformatters/gci/gci.go
89-
linters: [staticcheck]
90-
text: "SA1019: settings.LocalPrefixes is deprecated: use Sections instead."
91-
92-
# Related to `run.go`, it cannot be removed.
93-
- path: pkg/golinters/gofumpt/gofumpt.go
94-
linters: [staticcheck]
95-
text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead."
96-
9775
# Based on existing code, the modifications should be limited to make maintenance easier.
9876
- path: pkg/golinters/unused/unused.go
9977
linters: [gocritic]

Diff for: jsonschema/golangci.next.jsonschema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4214,7 +4214,7 @@
42144214
"type": "boolean",
42154215
"default": false
42164216
},
4217-
"presets": {
4217+
"presets": {
42184218
"type": "array",
42194219
"items": {
42204220
"enum": [

Diff for: pkg/result/processors/max_per_file_from_linter.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ package processors
22

33
import (
44
"github.com/golangci/golangci-lint/pkg/config"
5+
"github.com/golangci/golangci-lint/pkg/goformatters/gci"
6+
"github.com/golangci/golangci-lint/pkg/goformatters/gofmt"
7+
"github.com/golangci/golangci-lint/pkg/goformatters/gofumpt"
8+
"github.com/golangci/golangci-lint/pkg/goformatters/goimports"
9+
"github.com/golangci/golangci-lint/pkg/goformatters/golines"
510
"github.com/golangci/golangci-lint/pkg/result"
611
)
712

@@ -19,10 +24,9 @@ func NewMaxPerFileFromLinter(cfg *config.Config) *MaxPerFileFromLinter {
1924
if !cfg.Issues.NeedFix {
2025
// if we don't fix we do this limiting to not annoy user;
2126
// otherwise we need to fix all issues in the file at once
22-
maxPerFileFromLinterConfig["gofmt"] = 1
23-
maxPerFileFromLinterConfig["goimports"] = 1
24-
maxPerFileFromLinterConfig["gci"] = 1
25-
maxPerFileFromLinterConfig["golines"] = 1
27+
for _, f := range []string{gofmt.Name, gofumpt.Name, goimports.Name, gci.Name, golines.Name} {
28+
maxPerFileFromLinterConfig[f] = 1
29+
}
2630
}
2731

2832
return &MaxPerFileFromLinter{

0 commit comments

Comments
 (0)