Skip to content

Commit

Permalink
Document return types
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Feb 27, 2025
1 parent 1a802ef commit fe8992c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func (c RejectionCondition) matchesUserText(p *payload) bool {
return c.UserTextMatch == "" || regexp.MustCompile(c.UserTextMatch).MatchString(p.UserText)
}

// Returns a rejection reason and error code if the payload should be rejected by this condition, otherwise nil.
func (c RejectionCondition) shouldReject(p *payload) (*string, *string) {
if c.matchesApp(p) && c.matchesVersion(p) && c.matchesLabel(p) && c.matchesUserText(p) {
// RejectionCondition matches all of the conditions: we should reject this submission/
Expand All @@ -172,6 +173,7 @@ func (c RejectionCondition) shouldReject(p *payload) (*string, *string) {
return nil, nil
}

// Returns a rejection reason and error code if the payload should be rejected by any condition, otherwise nil.
func (c *config) matchesRejectionCondition(p *payload) (*string, *string) {
for _, rc := range c.RejectionConditions {
reject, code := rc.shouldReject(p)
Expand Down

0 comments on commit fe8992c

Please sign in to comment.