File tree 1 file changed +6
-0
lines changed
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ type RuleBase struct {
15
15
config * Config
16
16
}
17
17
18
+ // NewRuleBase creates a new RuleBase instance. It should be embedded to your own
19
+ // rule instance.
18
20
func NewRuleBase (name string , desc string ) * RuleBase {
19
21
return & RuleBase {
20
22
name : name ,
@@ -37,11 +39,15 @@ func (r *RuleBase) VisitWorkflowPre(node *Workflow) error { return nil }
37
39
// VisitWorkflowPost is callback when visiting Workflow node after visiting its children.
38
40
func (r * RuleBase ) VisitWorkflowPost (node * Workflow ) error { return nil }
39
41
42
+ // Error creates a new error from the source position and the error message and stores it in the
43
+ // rule instance. The errors can be accessed by Errs method.
40
44
func (r * RuleBase ) Error (pos * Pos , msg string ) {
41
45
err := errorAt (pos , r .name , msg )
42
46
r .errs = append (r .errs , err )
43
47
}
44
48
49
+ // Errorf reports a new error with the source position and the formatted error message and stores it
50
+ // in the rule instance. The errors can be accessed by Errs method.
45
51
func (r * RuleBase ) Errorf (pos * Pos , format string , args ... interface {}) {
46
52
err := errorfAt (pos , r .name , format , args ... )
47
53
r .errs = append (r .errs , err )
You can’t perform that action at this time.
0 commit comments