fix: GHPullRequestReviewComment.getLine() returning -1#2188
fix: GHPullRequestReviewComment.getLine() returning -1#2188Anonycoders wants to merge 1 commit intohub4j:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2188 +/- ##
=========================================
Coverage 85.01% 85.02%
- Complexity 2495 2496 +1
=========================================
Files 237 237
Lines 7355 7357 +2
Branches 388 388
=========================================
+ Hits 6253 6255 +2
Misses 871 871
Partials 231 231 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@Anonycoders Great catch here! The comments on the methods and the test showing working behavior are good. However, your comments also make it clear this is a behavior is truly bizarre and likely to cause confusion downstream (even with your comments). I'd like you to consider a couple other options: Option 1: Return classes that match the records
Option 2: Auto-refresh incomplete records, hiding the bad behavior
I think I'd prefer Option 1, it's clear and makes expensive behavior visible. Here's the And here's the full GHPullRequestReviewComment: |
I'd also prefer option No. 1. let me see what I can do about it and shape the PR(s). |
Description
refresh()method to fetch complete comment data from the APIProblem
When fetching review comments through
review.listReviewComments(), thegetLine()method always returns -1. This is because the GitHub API endpoint/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/commentsdoes not returnline,original_line,side, and related fields.Solution
refresh()method - ImplementsRefreshableinterface, allowing users to fetch complete comment data:getLine(),getSide(), and related methods explaining when -1/UNKNOWN is returned.Before submitting a PR:
@linkJavaDoc entries to the relevant documentation on https://docs.github.com/en/rest .mvn -D enable-ci clean install site "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"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: