Skip to content

Commit 3e54dd3

Browse files
committed
chore: groups revive files to a package
1 parent 56774ad commit 3e54dd3

File tree

6 files changed

+21
-12
lines changed

6 files changed

+21
-12
lines changed

pkg/golinters/revive.go renamed to pkg/golinters/revive/revive.go

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

33
import (
44
"bytes"
@@ -23,20 +23,17 @@ import (
2323
"github.com/golangci/golangci-lint/pkg/result"
2424
)
2525

26-
const reviveName = "revive"
26+
const name = "revive"
2727

28-
var reviveDebugf = logutils.Debug(logutils.DebugKeyRevive)
28+
var debugf = logutils.Debug(logutils.DebugKeyRevive)
2929

3030
// jsonObject defines a JSON object of a failure
3131
type jsonObject struct {
3232
Severity lint.Severity
3333
lint.Failure `json:",inline"`
3434
}
3535

36-
// NewRevive returns a new Revive linter.
37-
//
38-
39-
func NewRevive(settings *config.ReviveSettings) *goanalysis.Linter {
36+
func New(settings *config.ReviveSettings) *goanalysis.Linter {
4037
var mu sync.Mutex
4138
var resIssues []goanalysis.Issue
4239

@@ -47,7 +44,7 @@ func NewRevive(settings *config.ReviveSettings) *goanalysis.Linter {
4744
}
4845

4946
return goanalysis.NewLinter(
50-
reviveName,
47+
name,
5148
"Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.",
5249
[]*analysis.Analyzer{analyzer},
5350
nil,
@@ -154,7 +151,7 @@ func reviveToIssue(pass *analysis.Pass, object *jsonObject) goanalysis.Issue {
154151
From: object.Position.Start.Line,
155152
To: lineRangeTo,
156153
},
157-
FromLinter: reviveName,
154+
FromLinter: name,
158155
}, pass)
159156
}
160157

@@ -192,7 +189,7 @@ func getReviveConfig(cfg *config.ReviveSettings) (*lint.Config, error) {
192189
conf.Rules[k] = r
193190
}
194191

195-
reviveDebugf("revive configuration: %#v", conf)
192+
debugf("revive configuration: %#v", conf)
196193

197194
return conf, nil
198195
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package revive
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/revive.go renamed to pkg/golinters/revive/testdata/revive.go

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

55
import (

pkg/lint/lintersdb/builder_linter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ import (
8484
"github.com/golangci/golangci-lint/pkg/golinters/promlinter"
8585
"github.com/golangci/golangci-lint/pkg/golinters/protogetter"
8686
"github.com/golangci/golangci-lint/pkg/golinters/reassign"
87+
"github.com/golangci/golangci-lint/pkg/golinters/revive"
8788
"github.com/golangci/golangci-lint/pkg/golinters/spancheck"
8889
"github.com/golangci/golangci-lint/pkg/golinters/tagalign"
8990
"github.com/golangci/golangci-lint/pkg/golinters/whitespace"
@@ -625,7 +626,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
625626
WithLoadForGoAnalysis().
626627
WithURL("https://github.com/curioswitch/go-reassign"),
627628

628-
linter.NewConfig(golinters.NewRevive(&cfg.LintersSettings.Revive)).
629+
linter.NewConfig(revive.New(&cfg.LintersSettings.Revive)).
629630
WithSince("v1.37.0").
630631
WithPresets(linter.PresetStyle, linter.PresetMetaLinter).
631632
ConsiderSlow().

0 commit comments

Comments
 (0)