9
9
"reflect"
10
10
11
11
"github.com/BurntSushi/toml"
12
- "github.com/mgechev/dots"
13
12
reviveConfig "github.com/mgechev/revive/config"
14
13
"github.com/mgechev/revive/lint"
15
14
"github.com/mgechev/revive/rule"
@@ -50,10 +49,10 @@ func NewRevive(cfg *config.ReviveSettings) *goanalysis.Linter {
50
49
).WithContextSetter (func (lintCtx * linter.Context ) {
51
50
analyzer .Run = func (pass * analysis.Pass ) (interface {}, error ) {
52
51
var files []string
53
-
54
52
for _ , file := range pass .Files {
55
53
files = append (files , pass .Fset .PositionFor (file .Pos (), false ).Filename )
56
54
}
55
+ packages := [][]string {files }
57
56
58
57
conf , err := getReviveConfig (cfg )
59
58
if err != nil {
@@ -72,11 +71,6 @@ func NewRevive(cfg *config.ReviveSettings) *goanalysis.Linter {
72
71
return nil , err
73
72
}
74
73
75
- packages , err := dots .ResolvePackages (files , []string {})
76
- if err != nil {
77
- return nil , err
78
- }
79
-
80
74
failures , err := revive .Lint (packages , lintingRules , * conf )
81
75
if err != nil {
82
76
return nil , err
@@ -315,6 +309,16 @@ const defaultConfidence = 0.8
315
309
// This element is not exported by revive, so we need copy the code.
316
310
// Extracted from https://github.com/mgechev/revive/blob/v1.1.4/config/config.go#L145
317
311
func normalizeConfig (cfg * lint.Config ) {
312
+ // NOTE: custom section must be keep.
313
+ // ---
314
+ if cfg .Confidence == 0 {
315
+ cfg .Confidence = defaultConfidence
316
+ }
317
+ if cfg .Severity == "" {
318
+ cfg .Severity = lint .SeverityWarning
319
+ }
320
+ // ---
321
+
318
322
if len (cfg .Rules ) == 0 {
319
323
cfg .Rules = map [string ]lint.RuleConfig {}
320
324
}
0 commit comments