Deprecate 'scopelint' linter (#1819)

* Deprecate scopelint linter

* clean code base.
This commit is contained in:
Ludovic Fernandez 2021-03-09 19:19:22 +01:00 committed by GitHub
parent 8d0075da00
commit fce3949d5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 11 deletions

View File

@ -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

1
go.sum generated
View File

@ -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=

View File

@ -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
}

View File

@ -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().

View File

@ -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)

View File

@ -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)
})
}
}

View File

@ -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,
)
})
}

View File

@ -1,4 +1,4 @@
//args: -Escopelint
//args: -Escopelint --internal-cmd-test
package testdata
import "fmt"