From c52160e27626246e00b771803d3f766702eb6432 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sat, 22 Feb 2025 23:11:48 +0100 Subject: [PATCH 1/2] chore: clean configuration --- .golangci.yml | 22 ---------------------- jsonschema/golangci.next.jsonschema.json | 2 +- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f39cb811a799..e4acf0709bf2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -72,28 +72,6 @@ linters: - mnd - lll - # Deprecated linter options. - - path: pkg/golinters/errcheck/errcheck.go - linters: [staticcheck] - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/golinters/errcheck/errcheck.go - linters: [staticcheck] - text: "SA1019: errCfg.Ignore is deprecated: use ExcludeFunctions instead" - - path: pkg/golinters/govet/govet.go - linters: [staticcheck] - text: "SA1019: cfg.CheckShadowing is deprecated: the linter should be enabled inside Enable." - - path: pkg/golinters/godot/godot.go - linters: [staticcheck] - text: "SA1019: settings.CheckAll is deprecated: use Scope instead" - - path: pkg/goformatters/gci/gci.go - linters: [staticcheck] - text: "SA1019: settings.LocalPrefixes is deprecated: use Sections instead." - - # Related to `run.go`, it cannot be removed. - - path: pkg/golinters/gofumpt/gofumpt.go - linters: [staticcheck] - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - # Based on existing code, the modifications should be limited to make maintenance easier. - path: pkg/golinters/unused/unused.go linters: [gocritic] diff --git a/jsonschema/golangci.next.jsonschema.json b/jsonschema/golangci.next.jsonschema.json index 25231fdea79c..65a1a31b7b65 100644 --- a/jsonschema/golangci.next.jsonschema.json +++ b/jsonschema/golangci.next.jsonschema.json @@ -4214,7 +4214,7 @@ "type": "boolean", "default": false }, - "presets": { + "presets": { "type": "array", "items": { "enum": [ From b957579dbb6c047196275b37ef6d434aa20421a7 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sat, 22 Feb 2025 23:28:18 +0100 Subject: [PATCH 2/2] chore: apply same limitations on all formatters --- pkg/result/processors/max_per_file_from_linter.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/result/processors/max_per_file_from_linter.go b/pkg/result/processors/max_per_file_from_linter.go index 2a6c79cd7b27..a5ad66d4e5af 100644 --- a/pkg/result/processors/max_per_file_from_linter.go +++ b/pkg/result/processors/max_per_file_from_linter.go @@ -2,6 +2,11 @@ package processors import ( "github.com/golangci/golangci-lint/pkg/config" + "github.com/golangci/golangci-lint/pkg/goformatters/gci" + "github.com/golangci/golangci-lint/pkg/goformatters/gofmt" + "github.com/golangci/golangci-lint/pkg/goformatters/gofumpt" + "github.com/golangci/golangci-lint/pkg/goformatters/goimports" + "github.com/golangci/golangci-lint/pkg/goformatters/golines" "github.com/golangci/golangci-lint/pkg/result" ) @@ -19,10 +24,9 @@ func NewMaxPerFileFromLinter(cfg *config.Config) *MaxPerFileFromLinter { if !cfg.Issues.NeedFix { // if we don't fix we do this limiting to not annoy user; // otherwise we need to fix all issues in the file at once - maxPerFileFromLinterConfig["gofmt"] = 1 - maxPerFileFromLinterConfig["goimports"] = 1 - maxPerFileFromLinterConfig["gci"] = 1 - maxPerFileFromLinterConfig["golines"] = 1 + for _, f := range []string{gofmt.Name, gofumpt.Name, goimports.Name, gci.Name, golines.Name} { + maxPerFileFromLinterConfig[f] = 1 + } } return &MaxPerFileFromLinter{