Skip to content

Commit 7b8e1fb

Browse files
author
Shivam Mukhade
committed
Fixes lint error for multiple if-else
1 parent ee59e28 commit 7b8e1fb

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pkg/provider/bitbucketcloud/events.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,14 @@ func (v *Provider) ParsePayload(ctx context.Context, run *params.Run, request *h
131131
processedEvent.TriggerTarget = "pull_request"
132132
processedEvent.EventType = "pull_request"
133133
} else if provider.Valid(event, []string{"pullrequest:comment_created"}) {
134-
if provider.IsRetestComment(e.Comment.Content.Raw) {
134+
switch {
135+
case provider.IsRetestComment(e.Comment.Content.Raw):
135136
processedEvent.TriggerTarget = "pull_request"
136137
processedEvent.EventType = "retest-comment"
137-
} else if provider.IsOkToTestComment(e.Comment.Content.Raw) {
138+
case provider.IsOkToTestComment(e.Comment.Content.Raw):
138139
processedEvent.TriggerTarget = "pull_request"
139140
processedEvent.EventType = "ok-to-test-comment"
140-
} else if provider.IsTestComment(e.Comment.Content.Raw) {
141+
case provider.IsTestComment(e.Comment.Content.Raw):
141142
processedEvent.TriggerTarget = "pull_request"
142143
processedEvent.EventType = "test-comment"
143144
processedEvent.TargetTestPipelineRun = provider.GetPipelineRunFromComment(e.Comment.Content.Raw)

pkg/provider/bitbucketserver/events.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ func (v *Provider) ParsePayload(_ context.Context, _ *params.Run, request *http.
5252
processedEvent.TriggerTarget = "pull_request"
5353
processedEvent.EventType = "pull_request"
5454
} else if provider.Valid(eventType, []string{"pr:comment:added", "pr:comment:edited"}) {
55-
if provider.IsRetestComment(e.Comment.Text) {
55+
switch {
56+
case provider.IsRetestComment(e.Comment.Text):
5657
processedEvent.TriggerTarget = "pull_request"
5758
processedEvent.EventType = "retest-comment"
58-
} else if provider.IsOkToTestComment(e.Comment.Text) {
59+
case provider.IsOkToTestComment(e.Comment.Text):
5960
processedEvent.TriggerTarget = "pull_request"
6061
processedEvent.EventType = "ok-to-test-comment"
61-
} else if provider.IsTestComment(e.Comment.Text) {
62+
case provider.IsTestComment(e.Comment.Text):
6263
processedEvent.TriggerTarget = "pull_request"
6364
processedEvent.EventType = "test-comment"
6465
processedEvent.TargetTestPipelineRun = provider.GetPipelineRunFromComment(e.Comment.Text)

0 commit comments

Comments
 (0)