Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yokomotod committed Apr 10, 2024
1 parent a307254 commit 12e1dac
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/notifier/gitlab/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import (
gitlab "github.com/xanzy/go-gitlab"
)

const (
listPerPage = 100
maxPages = 100
)

// CommentService handles communication with the comment related
// methods of GitLab API
type CommentService service
Expand Down Expand Up @@ -64,7 +69,7 @@ func (g *CommentService) List(number int) ([]*gitlab.Note, error) {
opt := &gitlab.ListMergeRequestNotesOptions{
ListOptions: gitlab.ListOptions{
Page: 1,
PerPage: 100,
PerPage: listPerPage,
},
}

Expand All @@ -73,7 +78,6 @@ func (g *CommentService) List(number int) ([]*gitlab.Note, error) {
number,
opt,
)

if err != nil {
return nil, err
}
Expand All @@ -86,7 +90,7 @@ func (g *CommentService) List(number int) ([]*gitlab.Note, error) {

opt.Page = resp.NextPage

if sentinel > 100 {
if sentinel > maxPages {
return nil, fmt.Errorf("gitlab.comment.list: too many pages, something went wrong")
}
}
Expand Down

0 comments on commit 12e1dac

Please sign in to comment.