Skip to content

Commit 0fa0c81

Browse files
committedAug 1, 2023
add missing documents to APIs made public at #327
1 parent fbb13d8 commit 0fa0c81

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎rule.go

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ type RuleBase struct {
1515
config *Config
1616
}
1717

18+
// NewRuleBase creates a new RuleBase instance. It should be embedded to your own
19+
// rule instance.
1820
func NewRuleBase(name string, desc string) *RuleBase {
1921
return &RuleBase{
2022
name: name,
@@ -37,11 +39,15 @@ func (r *RuleBase) VisitWorkflowPre(node *Workflow) error { return nil }
3739
// VisitWorkflowPost is callback when visiting Workflow node after visiting its children.
3840
func (r *RuleBase) VisitWorkflowPost(node *Workflow) error { return nil }
3941

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.
4044
func (r *RuleBase) Error(pos *Pos, msg string) {
4145
err := errorAt(pos, r.name, msg)
4246
r.errs = append(r.errs, err)
4347
}
4448

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.
4551
func (r *RuleBase) Errorf(pos *Pos, format string, args ...interface{}) {
4652
err := errorfAt(pos, r.name, format, args...)
4753
r.errs = append(r.errs, err)

0 commit comments

Comments
 (0)
Please sign in to comment.