File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 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) {
9090 r .config = cfg
9191}
9292
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 {
9596 return r .config
9697}
9798
@@ -103,5 +104,5 @@ type Rule interface {
103104 Description () string
104105 EnableDebug (out io.Writer )
105106 SetConfig (cfg * Config )
106- GetConfig () * Config
107+ Config () * Config
107108}
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