Skip to content

Commit 7381031

Browse files
committed
chore: groups lll files to a package
1 parent fa0cf1d commit 7381031

File tree

8 files changed

+23
-11
lines changed

8 files changed

+23
-11
lines changed

pkg/golinters/lll.go renamed to pkg/golinters/lll/lll.go

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

33
import (
44
"bufio"
@@ -19,16 +19,16 @@ import (
1919
"github.com/golangci/golangci-lint/pkg/result"
2020
)
2121

22-
const lllName = "lll"
22+
const name = "lll"
2323

2424
const goCommentDirectivePrefix = "//go:"
2525

26-
func NewLLL(settings *config.LllSettings) *goanalysis.Linter {
26+
func New(settings *config.LllSettings) *goanalysis.Linter {
2727
var mu sync.Mutex
2828
var resIssues []goanalysis.Issue
2929

3030
analyzer := &analysis.Analyzer{
31-
Name: lllName,
31+
Name: name,
3232
Doc: goanalysis.TheOnlyanalyzerDoc,
3333
Run: func(pass *analysis.Pass) (any, error) {
3434
issues, err := runLll(pass, settings)
@@ -49,7 +49,7 @@ func NewLLL(settings *config.LllSettings) *goanalysis.Linter {
4949
}
5050

5151
return goanalysis.NewLinter(
52-
lllName,
52+
name,
5353
"Reports long lines",
5454
[]*analysis.Analyzer{analyzer},
5555
nil,
@@ -122,7 +122,7 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r
122122
Line: lineNumber,
123123
},
124124
Text: fmt.Sprintf("line is %d characters", lineLen),
125-
FromLinter: lllName,
125+
FromLinter: name,
126126
})
127127
}
128128
}
@@ -146,7 +146,7 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r
146146
Column: 1,
147147
},
148148
Text: fmt.Sprintf("line is more than %d characters", bufio.MaxScanTokenSize),
149-
FromLinter: lllName,
149+
FromLinter: name,
150150
})
151151
} else {
152152
return nil, fmt.Errorf("can't scan file %s: %w", filename, err)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package lll
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/lll.go renamed to pkg/golinters/lll/testdata/lll.go

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

55
import (
File renamed without changes.

test/testdata/lll_import_multi.go renamed to pkg/golinters/lll/testdata/lll_import_multi.go

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

test/testdata/lll_import_single.go renamed to pkg/golinters/lll/testdata/lll_import_single.go

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

pkg/lint/lintersdb/builder_linter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import (
6060
"github.com/golangci/golangci-lint/pkg/golinters/interfacebloat"
6161
"github.com/golangci/golangci-lint/pkg/golinters/intrange"
6262
"github.com/golangci/golangci-lint/pkg/golinters/ireturn"
63+
"github.com/golangci/golangci-lint/pkg/golinters/lll"
6364
"github.com/golangci/golangci-lint/pkg/golinters/loggercheck"
6465
"github.com/golangci/golangci-lint/pkg/golinters/mirror"
6566
"github.com/golangci/golangci-lint/pkg/golinters/misspell"
@@ -469,7 +470,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
469470
WithLoadForGoAnalysis().
470471
WithURL("https://github.com/butuzov/ireturn"),
471472

472-
linter.NewConfig(golinters.NewLLL(&cfg.LintersSettings.Lll)).
473+
linter.NewConfig(lll.New(&cfg.LintersSettings.Lll)).
473474
WithSince("v1.8.0").
474475
WithPresets(linter.PresetStyle),
475476

0 commit comments

Comments
 (0)