8
8
"go/token"
9
9
"os"
10
10
"reflect"
11
+ "sort"
11
12
"sync"
12
13
13
14
"github.com/BurntSushi/toml"
@@ -27,7 +28,10 @@ import (
27
28
28
29
const linterName = "revive"
29
30
30
- var debugf = logutils .Debug (logutils .DebugKeyRevive )
31
+ var (
32
+ debugf = logutils .Debug (logutils .DebugKeyRevive )
33
+ isDebug = logutils .HaveDebugTag (logutils .DebugKeyRevive )
34
+ )
31
35
32
36
// jsonObject defines a JSON object of a failure
33
37
type jsonObject struct {
@@ -228,14 +232,23 @@ func getConfig(cfg *config.ReviveSettings) (*lint.Config, error) {
228
232
229
233
normalizeConfig (conf )
230
234
235
+ rulesEnabledByConfig := []string {}
231
236
for k , r := range conf .Rules {
232
237
err := r .Initialize ()
233
238
if err != nil {
234
239
return nil , fmt .Errorf ("error in config of rule %q: %w" , k , err )
235
240
}
236
241
conf .Rules [k ] = r
242
+
243
+ if ! r .Disabled {
244
+ rulesEnabledByConfig = append (rulesEnabledByConfig , k )
245
+ }
237
246
}
238
247
248
+ debugChecksListf (extractRulesName (allRules ), "All available analyzers" )
249
+ debugChecksListf (extractRulesName (defaultRules ), "Default analyzers" )
250
+ debugChecksListf (rulesEnabledByConfig , "Enabled by config analyzers" )
251
+
239
252
debugf ("revive configuration: %#v" , conf )
240
253
241
254
return conf , nil
@@ -447,3 +460,20 @@ func defaultConfig() *lint.Config {
447
460
}
448
461
return & defaultConfig
449
462
}
463
+
464
+ func extractRulesName (rules []lint.Rule ) []string {
465
+ names := []string {}
466
+ for _ , r := range rules {
467
+ names = append (names , r .Name ())
468
+ }
469
+ return names
470
+ }
471
+
472
+ func debugChecksListf (checks []string , format string , args ... any ) {
473
+ if ! isDebug {
474
+ return
475
+ }
476
+ sort .Strings (checks )
477
+
478
+ debugf ("%s checks (%d): %s" , fmt .Sprintf (format , args ... ), len (checks ), fmt .Sprint (checks ))
479
+ }
0 commit comments