99 "reflect"
1010
1111 "github.com/BurntSushi/toml"
12- "github.com/mgechev/dots"
1312 reviveConfig "github.com/mgechev/revive/config"
1413 "github.com/mgechev/revive/lint"
1514 "github.com/mgechev/revive/rule"
@@ -50,10 +49,10 @@ func NewRevive(cfg *config.ReviveSettings) *goanalysis.Linter {
5049 ).WithContextSetter (func (lintCtx * linter.Context ) {
5150 analyzer .Run = func (pass * analysis.Pass ) (interface {}, error ) {
5251 var files []string
53-
5452 for _ , file := range pass .Files {
5553 files = append (files , pass .Fset .PositionFor (file .Pos (), false ).Filename )
5654 }
55+ packages := [][]string {files }
5756
5857 conf , err := getReviveConfig (cfg )
5958 if err != nil {
@@ -72,11 +71,6 @@ func NewRevive(cfg *config.ReviveSettings) *goanalysis.Linter {
7271 return nil , err
7372 }
7473
75- packages , err := dots .ResolvePackages (files , []string {})
76- if err != nil {
77- return nil , err
78- }
79-
8074 failures , err := revive .Lint (packages , lintingRules , * conf )
8175 if err != nil {
8276 return nil , err
@@ -315,6 +309,16 @@ const defaultConfidence = 0.8
315309// This element is not exported by revive, so we need copy the code.
316310// Extracted from https://github.com/mgechev/revive/blob/v1.1.4/config/config.go#L145
317311func normalizeConfig (cfg * lint.Config ) {
312+ // NOTE(ldez): this custom section for golangci-lint should be kept.
313+ // ---
314+ if cfg .Confidence == 0 {
315+ cfg .Confidence = defaultConfidence
316+ }
317+ if cfg .Severity == "" {
318+ cfg .Severity = lint .SeverityWarning
319+ }
320+ // ---
321+
318322 if len (cfg .Rules ) == 0 {
319323 cfg .Rules = map [string ]lint.RuleConfig {}
320324 }
0 commit comments