diff --git a/.golangci.yml b/.golangci.yml index f2fcc17c..d625ff80 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -73,6 +73,7 @@ linters: - dogsled - dupl - errcheck + - exportloopref - exhaustive - funlen - gochecknoinits @@ -94,7 +95,6 @@ linters: - noctx - nolintlint - rowserrcheck - - scopelint - staticcheck - structcheck - stylecheck @@ -107,6 +107,7 @@ linters: # don't enable: # - asciicheck + # - scopelint # - gochecknoglobals # - gocognit # - godot diff --git a/go.sum b/go.sum index 52801bb7..1ea9edb0 100644 --- a/go.sum +++ b/go.sum @@ -546,7 +546,6 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210217105451-b926d437f341 h1:2/QtM1mL37YmcsT8HaDNHDgTqqFVw+zr8UzMiBVLzYU= golang.org/x/sys v0.0.0-20210217105451-b926d437f341/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/pkg/golinters/gofmt_common.go b/pkg/golinters/gofmt_common.go index 3235622e..39e8092e 100644 --- a/pkg/golinters/gofmt_common.go +++ b/pkg/golinters/gofmt_common.go @@ -176,7 +176,7 @@ func (p *hunkChangesParser) parse(h *diffpkg.Hunk) []Change { for i := 0; i < len(p.lines); { line := p.lines[i] if line.typ == diffLineOriginal { - p.handleOriginalLine(line, &i) //nolint:scopelint + p.handleOriginalLine(line, &i) continue } diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index 5f1b1f0f..6dd28f05 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -271,7 +271,8 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithURL("https://github.com/alexkohler/prealloc"), linter.NewConfig(golinters.NewScopelint()). WithPresets(linter.PresetBugs). - WithURL("https://github.com/kyoh86/scopelint"), + WithURL("https://github.com/kyoh86/scopelint"). + Deprecated("The repository of the linter has been deprecated by the owner. Use 'exportloopref' instead."), linter.NewConfig(golinters.NewGocritic()). WithPresets(linter.PresetStyle). WithLoadForGoAnalysis(). diff --git a/pkg/result/processors/fixer.go b/pkg/result/processors/fixer.go index 75fdc93f..17f519e3 100644 --- a/pkg/result/processors/fixer.go +++ b/pkg/result/processors/fixer.go @@ -57,7 +57,7 @@ func (f Fixer) Process(issues []result.Issue) []result.Issue { for file, issuesToFix := range issuesToFixPerFile { var err error f.sw.TrackStage("all", func() { - err = f.fixIssuesInFile(file, issuesToFix) //nolint:scopelint + err = f.fixIssuesInFile(file, issuesToFix) }) if err != nil { f.log.Errorf("Failed to fix issues in file %s: %s", file, err) diff --git a/pkg/result/processors/path_prefixer_test.go b/pkg/result/processors/path_prefixer_test.go index e4b4c86e..55fdbea9 100644 --- a/pkg/result/processors/path_prefixer_test.go +++ b/pkg/result/processors/path_prefixer_test.go @@ -27,11 +27,11 @@ func TestPathPrefixer_Process(t *testing.T) { t.Run(tt.name, func(t *testing.T) { r := require.New(t) - p := NewPathPrefixer(tt.prefix) //nolint:scopelint - got, err := p.Process(tt.issues) //nolint:scopelint + p := NewPathPrefixer(tt.prefix) + got, err := p.Process(tt.issues) r.NoError(err, "prefixer should never error") - r.Equal(got, tt.want) //nolint:scopelint + r.Equal(got, tt.want) }) } } diff --git a/test/run_test.go b/test/run_test.go index 34a07366..e644b2e9 100644 --- a/test/run_test.go +++ b/test/run_test.go @@ -337,9 +337,9 @@ func TestPathPrefix(t *testing.T) { } { t.Run(tt.Name, func(t *testing.T) { testshared.NewLintRunner(t).Run( - append(tt.Args, getTestDataDir("withtests"))..., //nolint:scopelint + append(tt.Args, getTestDataDir("withtests"))..., ).ExpectOutputRegexp( - tt.Pattern, //nolint:scopelint + tt.Pattern, ) }) } diff --git a/test/testdata/scopelint.go b/test/testdata/scopelint.go index 346387f4..1404841a 100644 --- a/test/testdata/scopelint.go +++ b/test/testdata/scopelint.go @@ -1,4 +1,4 @@ -//args: -Escopelint +//args: -Escopelint --internal-cmd-test package testdata import "fmt"