File tree 2 files changed +19
-3
lines changed
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -90,8 +90,9 @@ func (r *RuleBase) SetConfig(cfg *Config) {
90
90
r .config = cfg
91
91
}
92
92
93
- // GetConfig returns the config of the rule
94
- func (r * RuleBase ) GetConfig () * Config {
93
+ // Config returns the user configuration of actionlint. When no config was set to this rule by SetConfig,
94
+ // this method returns nil.
95
+ func (r * RuleBase ) Config () * Config {
95
96
return r .config
96
97
}
97
98
@@ -103,5 +104,5 @@ type Rule interface {
103
104
Description () string
104
105
EnableDebug (out io.Writer )
105
106
SetConfig (cfg * Config )
106
- GetConfig () * Config
107
+ Config () * Config
107
108
}
Original file line number Diff line number Diff line change
1
+ package actionlint
2
+
3
+ import "testing"
4
+
5
+ func TestRuleBaseConfig (t * testing.T ) {
6
+ r := NewRuleBase ("" , "" )
7
+ if r .Config () != nil {
8
+ t .Error ("Config must be nil after creating a rule" )
9
+ }
10
+ want := & Config {}
11
+ r .SetConfig (want )
12
+ if have := r .Config (); have != want {
13
+ t .Errorf ("Wanted config %v but got %v" , want , have )
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments