Skip to content

Commit e9631ea

Browse files
committed
chore: groups nestif files to a package
1 parent 16b3e77 commit e9631ea

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

pkg/golinters/nestif.go renamed to pkg/golinters/nestif/nestif.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package golinters
1+
package nestif
22

33
import (
44
"sort"
@@ -13,9 +13,9 @@ import (
1313
"github.com/golangci/golangci-lint/pkg/result"
1414
)
1515

16-
const nestifName = "nestif"
16+
const name = "nestif"
1717

18-
func NewNestif(settings *config.NestifSettings) *goanalysis.Linter {
18+
func New(settings *config.NestifSettings) *goanalysis.Linter {
1919
var mu sync.Mutex
2020
var resIssues []goanalysis.Issue
2121

@@ -38,7 +38,7 @@ func NewNestif(settings *config.NestifSettings) *goanalysis.Linter {
3838
}
3939

4040
return goanalysis.NewLinter(
41-
nestifName,
41+
name,
4242
"Reports deeply nested if statements",
4343
[]*analysis.Analyzer{analyzer},
4444
nil,
@@ -70,7 +70,7 @@ func runNestIf(pass *analysis.Pass, settings *config.NestifSettings) []goanalysi
7070
issues = append(issues, goanalysis.NewIssue(&result.Issue{
7171
Pos: i.Pos,
7272
Text: i.Message,
73-
FromLinter: nestifName,
73+
FromLinter: name,
7474
}, pass))
7575
}
7676

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package nestif
2+
3+
import (
4+
"testing"
5+
6+
"github.com/golangci/golangci-lint/test/testshared/integration"
7+
)
8+
9+
func TestFromTestdata(t *testing.T) {
10+
integration.RunTestdata(t)
11+
}

test/testdata/nestif.go renamed to pkg/golinters/nestif/testdata/nestif.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//golangcitest:args -Enestif
2-
//golangcitest:config_path testdata/configs/nestif.yml
2+
//golangcitest:config_path testdata/nestif.yml
33
package testdata
44

55
func _() {

pkg/lint/lintersdb/builder_linter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import (
6969
"github.com/golangci/golangci-lint/pkg/golinters/mnd"
7070
"github.com/golangci/golangci-lint/pkg/golinters/musttag"
7171
"github.com/golangci/golangci-lint/pkg/golinters/nakedret"
72+
"github.com/golangci/golangci-lint/pkg/golinters/nestif"
7273
"github.com/golangci/golangci-lint/pkg/golinters/nolintlint"
7374
"github.com/golangci/golangci-lint/pkg/golinters/protogetter"
7475
"github.com/golangci/golangci-lint/pkg/golinters/spancheck"
@@ -527,7 +528,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
527528
WithPresets(linter.PresetStyle).
528529
WithURL("https://github.com/alexkohler/nakedret"),
529530

530-
linter.NewConfig(golinters.NewNestif(&cfg.LintersSettings.Nestif)).
531+
linter.NewConfig(nestif.New(&cfg.LintersSettings.Nestif)).
531532
WithSince("v1.25.0").
532533
WithPresets(linter.PresetComplexity).
533534
WithURL("https://github.com/nakabonne/nestif"),

0 commit comments

Comments
 (0)