Skip to content

Commit

Permalink
Remove "empty" and rename "duplicate" to "identical"
Browse files Browse the repository at this point in the history
  • Loading branch information
uudashr authored and ldez committed Sep 18, 2024
1 parent a64220f commit 4738820
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 34 deletions.
9 changes: 7 additions & 2 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1227,9 +1227,14 @@ linters-settings:
# Default: []
enable:
- unused
- empty
- duplicate
- identical
- opaque
settings:
unused:
# Comma-separated list of packages to exclude from the check.
# Default: []
exclude:
- github.com/example/log

importas:
# Do not allow unaliased imports of aliased packages.
Expand Down
3 changes: 1 addition & 2 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,8 @@
},
"iface-analyzers": {
"enum": [
"empty",
"unused",
"duplicate",
"identical",
"opaque"
]
},
Expand Down
6 changes: 2 additions & 4 deletions pkg/golinters/iface/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import (

"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/goanalysis"
"github.com/uudashr/iface/duplicate"
"github.com/uudashr/iface/empty"
"github.com/uudashr/iface/identical"
"github.com/uudashr/iface/opaque"
"github.com/uudashr/iface/unused"
"golang.org/x/tools/go/analysis"
)

var allAnalyzers = []*analysis.Analyzer{
unused.Analyzer,
empty.Analyzer,
duplicate.Analyzer,
identical.Analyzer,
opaque.Analyzer,
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/golinters/iface/iface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ func TestAnalyzersFromSettings(t *testing.T) {
}{
"nil analyzers": {
enable: nil,
expectedEnabled: []string{"unused", "empty", "duplicate", "opaque"},
expectedEnabled: []string{"unused", "identical", "opaque"},
},
"empty analyzers": {
enable: []string{},
expectedEnabled: []string{"unused", "empty", "duplicate", "opaque"},
expectedEnabled: []string{"unused", "identical", "opaque"},
},
"unused only": {
enable: []string{"unused"},
Expand All @@ -32,8 +32,8 @@ func TestAnalyzersFromSettings(t *testing.T) {
expectedEnabled: []string{"unused", "opaque"},
},
"all analyzers": {
enable: []string{"unused", "opaque", "empty", "duplicate"},
expectedEnabled: []string{"unused", "empty", "duplicate", "opaque"},
enable: []string{"unused", "opaque", "identical"},
expectedEnabled: []string{"unused", "identical", "opaque"},
},
}

Expand Down
11 changes: 0 additions & 11 deletions pkg/golinters/iface/testdata/duplicate.go

This file was deleted.

6 changes: 0 additions & 6 deletions pkg/golinters/iface/testdata/empty.go

This file was deleted.

4 changes: 0 additions & 4 deletions pkg/golinters/iface/testdata/empty.yml

This file was deleted.

11 changes: 11 additions & 0 deletions pkg/golinters/iface/testdata/identical.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//golangcitest:args -Eiface
//golangcitest:config_path testdata/identical.yml
package testdata

type Pinger interface { // want "interface Pinger contains identical methods or type constraints from another interface, causing redundancy"
Ping() error
}

type Healthcheck interface { // want "interface Healthcheck contains identical methods or type constraints from another interface, causing redundancy"
Ping() error
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
linters-settings:
iface:
enable:
- duplicate
- identical

0 comments on commit 4738820

Please sign in to comment.