-
Notifications
You must be signed in to change notification settings - Fork 752
Add support for multiline review comments #1833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiline review comments #1833
Conversation
On review comments or during the creation of a new review, support single and multi-line comments using `line` and `start_line` attributes. See: https://docs.github.com/en/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request and https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request
@bitwiseman Would it be possible to give me access to hub4j-test-org in order to finalize this PR by generating test data? |
@maximevw |
Hello @bitwiseman, I updated the tests to finalize this PR.
As it is the same principle, and it does not seem really relevant to write specific tests to cover simple getters in very basic POJOs, I preferred to skip the coverage of these getters. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1833 +/- ##
============================================
+ Coverage 80.79% 80.94% +0.15%
- Complexity 2417 2429 +12
============================================
Files 233 234 +1
Lines 7264 7301 +37
Branches 398 398
============================================
+ Hits 5869 5910 +41
+ Misses 1148 1145 -3
+ Partials 247 246 -1 ☔ View full report in Codecov by Sentry. |
.with("path", path) | ||
.with("start_line", endLine != null ? startLine : null) | ||
.with("line", endLine != null ? endLine : startLine) | ||
.withUrlPath(getApiRoute() + COMMENTS_ACTION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, the doc page for this endpoint is a nightmare of "required but in some cases not required" statements. 😭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's not so easy to understand (and I can say the Gitlab API for multiline comments is really worse in terms of complexity than the Github one 😄). I tried to keep it as simple as possible in this client.
Hello @bitwiseman Regarding the failed coverage test on the changes, as stated in my previous comment, it's only getters and it's very hard to cover these lines. I think we can ignore these warnings as the rest of the changes are covered.
I don't know if you still expect anything else from me regarding this PR. |
…tiline-review-comments
@maximevw Re: Coverage: Finally, with the complexity of the API, would it make more sense to have a |
@bitwiseman
|
src/main/java/org/kohsuke/github/GHPullRequestReviewCommentBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/kohsuke/github/GHPullRequestReviewBuilder.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions and questions. Open to discussion.
@bitwiseman I pushed the requested modifications and answered to your question regarding the deprecation of |
src/main/java/org/kohsuke/github/GHPullRequestReviewCommentBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/kohsuke/github/GHPullRequestReviewCommentBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/kohsuke/github/GHPullRequestReviewCommentBuilder.java
Outdated
Show resolved
Hide resolved
Thanks @bitwiseman for the last modifications, I was a little hasty when I pushed my changes... 😕 |
Description
When creating a new review or adding comments to an existing review, we can currently only add single line comments.
This pull request adds support for single and multi-line comments using
line
andstart_line
attributes.See: https://docs.github.com/en/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request
and https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request
I already prepared some tests for this and if you provide access to the
hub4j-test-org
, I will be able to finalize them.I also successfully tested these changes on a personal project.
This will solve #1645
Before submitting a PR:
@link
JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest .mvn -D enable-ci clean install site
locally. If this command doesn't succeed, your change will not pass CI.main
. You will create your PR from that branch.When creating a PR: