File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ package tflint
3
3
// Config is a TFLint configuration applied to the plugin.
4
4
// Currently, it is not expected that each plugin will reference this directly.
5
5
type Config struct {
6
- Rules map [string ]* RuleConfig
6
+ Rules map [string ]* RuleConfig
7
+ DisabledByDefault bool
7
8
}
8
9
9
10
// RuleConfig is a TFLint's rule configuration.
Original file line number Diff line number Diff line change 1
1
package tflint
2
2
3
- import "fmt"
3
+ import (
4
+ "fmt"
5
+ "log"
6
+ )
4
7
5
8
// RuleSet is a list of rules that a plugin should provide.
6
9
type RuleSet struct {
@@ -33,10 +36,17 @@ func (r *RuleSet) RuleNames() []string {
33
36
// Currently used only to enable/disable rules.
34
37
func (r * RuleSet ) ApplyConfig (config * Config ) {
35
38
rules := []Rule {}
39
+
40
+ if config .DisabledByDefault {
41
+ log .Printf ("[DEBUG] Only mode is enabled. Ignoring default plugin rules" )
42
+ }
43
+
36
44
for _ , rule := range r .Rules {
37
45
enabled := rule .Enabled ()
38
46
if cfg := config .Rules [rule .Name ()]; cfg != nil {
39
47
enabled = cfg .Enabled
48
+ } else if config .DisabledByDefault {
49
+ enabled = false
40
50
}
41
51
42
52
if enabled {
You can’t perform that action at this time.
0 commit comments