Skip to content

Commit 8a4ed95

Browse files
zakiskchmouel
authored andcommitted
cleanup: remove redunant IsCancelComment func
removed IsCancelComment func as we're using same func from provider package so it is redunant now. Signed-off-by: Zaki Shaikh <[email protected]>
1 parent f1b1834 commit 8a4ed95

File tree

3 files changed

+0
-56
lines changed

3 files changed

+0
-56
lines changed

pkg/opscomments/comments.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ func IsOkToTestComment(comment string) bool {
8888
return oktotestRegex.MatchString(comment)
8989
}
9090

91-
func IsCancelComment(comment string) bool {
92-
return cancelAllRegex.MatchString(comment) || cancelSingleRegex.MatchString(comment)
93-
}
94-
9591
// EventTypeBackwardCompat handle the backward compatibility we need to keep until
9692
// we have done the deprecated notice
9793
//

pkg/opscomments/comments_test.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -320,57 +320,6 @@ func TestIsOkToTestComment(t *testing.T) {
320320
}
321321
}
322322

323-
func TestCancelComment(t *testing.T) {
324-
tests := []struct {
325-
name string
326-
comment string
327-
want bool
328-
}{
329-
{
330-
name: "valid",
331-
comment: "/cancel",
332-
want: true,
333-
},
334-
{
335-
name: "valid with some string before",
336-
comment: "/lgtm \n/cancel",
337-
want: true,
338-
},
339-
{
340-
name: "valid with some string before and after",
341-
comment: "hi, trigger the ci \n/cancel \n then report the status back",
342-
want: true,
343-
},
344-
{
345-
name: "valid comments",
346-
comment: "/lgtm \n/cancel \n/approve",
347-
want: true,
348-
},
349-
{
350-
name: "invalid",
351-
comment: "/ok",
352-
want: false,
353-
},
354-
{
355-
name: "invalid comment",
356-
comment: "/ok-to-test abc",
357-
want: false,
358-
},
359-
{
360-
name: "cancel single pr",
361-
comment: "/cancel abc",
362-
want: true,
363-
},
364-
}
365-
366-
for _, tt := range tests {
367-
t.Run(tt.name, func(t *testing.T) {
368-
got := IsCancelComment(tt.comment)
369-
assert.Equal(t, tt.want, got)
370-
})
371-
}
372-
}
373-
374323
func TestIsTestRetestComment(t *testing.T) {
375324
tests := []struct {
376325
name string

pkg/provider/github/parse_payload.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ func (v *Provider) handleCommitCommentEvent(ctx context.Context, event *github.C
525525
err error
526526
)
527527

528-
// TODO: reuse the code from opscomments
529528
// If it is a /test or /retest comment with pipelinerun name figure out the pipelinerun name
530529
if provider.IsTestRetestComment(event.GetComment().GetBody()) {
531530
prName, branchName, err = provider.GetPipelineRunAndBranchNameFromTestComment(event.GetComment().GetBody())

0 commit comments

Comments
 (0)