MCPcopy Index your code
hub / github.com/cli/cli / sortComments

Function sortComments

pkg/cmd/pr/shared/comments.go:144–164  ·  view source on GitHub ↗
(cs api.Comments, rs api.PullRequestReviews)

Source from the content-addressed store, hash-verified

142}
143
144func sortComments(cs api.Comments, rs api.PullRequestReviews) []Comment {
145 comments := cs.Nodes
146 reviews := rs.Nodes
147 var sorted []Comment = make([]Comment, len(comments)+len(reviews))
148
149 var i int
150 for _, c := range comments {
151 sorted[i] = c
152 i++
153 }
154 for _, r := range reviews {
155 sorted[i] = r
156 i++
157 }
158
159 sort.Slice(sorted, func(i, j int) bool {
160 return sorted[i].Created().Before(sorted[j].Created())
161 })
162
163 return sorted
164}
165
166const (
167 approvedStatus = "APPROVED"

Callers 2

RawCommentListFunction · 0.85
CommentListFunction · 0.85

Calls 1

CreatedMethod · 0.65

Tested by

no test coverage detected