Skip to content

Commit

Permalink
github-pr-review: support multiline suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
haya14busa committed Jul 25, 2020
1 parent 998ef71 commit 841d3bd
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions service/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,7 @@ func buildSingleSuggestion(c *reviewdog.Comment, s *rdf.Suggestion) (string, err
if start.GetLine() != c.Result.Diagnostic.GetLocation().GetRange().GetStart().GetLine() {
return "", errors.New("Diagnostic and Suggestion lines must be the same.")
}
end := s.GetRange().GetEnd()
if !(end.GetLine() == 0 ||
(start.GetLine() == end.GetLine() && end.GetColumn() == 0) ||
(start.GetLine() == end.GetLine()+1 && end.GetColumn() == 1)) {
// It must be a suggestion for a single line change due to GitHub API
// restriction. Create a review for a pull request API [1] doesn't support
// comments to multi lines as of writing (2020-07-21).
// [1]: https://docs.github.com/en/rest/reference/pulls#create-a-review-for-a-pull-request
return "", errors.New("non single line")
}
if start.GetColumn() > 1 {
if start.GetColumn() > 1 || s.GetRange().GetEnd().GetColumn() > 1 {
// TODO(haya14busa): Support non-line based suggestion.
return "", errors.New("non line based")
}
Expand Down

0 comments on commit 841d3bd

Please sign in to comment.