Skip to content

Conversation

@joaolfp
Copy link
Contributor

@joaolfp joaolfp commented Jan 6, 2026

✨ Summary

I fixed copilot comments on #35 PR

πŸ”§ Type of Change

  • ✨ Enhancement
  • 🐞 Bug fix
  • πŸ” Security fix
  • πŸ’₯ Breaking change
  • πŸš€ New feature
  • πŸ“¦ New release
  • πŸ“š Documentation
  • ♻️ Refactor

Note

Refactor PR listing and models

  • Rename PullRequests::pull_requests_open to PullRequests::list_open and update CLI dispatch in src/cli.rs to call list_open
  • Rename User to PullRequestUser in src/pull_requests.rs; adjust PullRequestResponse.user type and improve docs
  • Clarify pagination in PullRequestItems with items (current page) and total_count (all pages); list_open prints totals and shows a table
  • Simplify tests/network_tests.rs to unwrap the network result and assert total_count and items.len()

Written by Cursor Bugbot for commit cbb5af4. This will update automatically on new commits. Configure here.

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

πŸŽ‰ All unit tests passed! βœ…

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses feedback from PR #35 by refactoring naming conventions, improving documentation, and simplifying test code. The changes focus on making the codebase more maintainable with clearer naming and better inline documentation.

  • Renamed pull_requests_open() method to list_open() for better API clarity
  • Renamed User struct to PullRequestUser to avoid generic naming and potential conflicts
  • Enhanced documentation for PullRequestItems to clarify pagination behavior

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/pull_requests.rs Renamed method and struct for clarity, added documentation comments explaining pagination behavior
src/cli.rs Updated function call to use renamed list_open() method
tests/network_tests.rs Simplified test assertion logic by removing match statement in favor of direct assertions

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 65 to 68
assert!(result.is_ok());
let prs = result.unwrap();
assert_eq!(prs.total_count, 2);
assert_eq!(prs.items.len(), 2);
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using assert!(result.is_ok()) followed by unwrap() is an anti-pattern. If result.is_ok() passes but unwrap() panics (which shouldn't happen but violates the DRY principle), you're testing the same condition twice. Consider using result.expect("Failed to get pull requests") or directly unwrap() instead, which will provide clear error messages if the test fails.

Suggested change
assert!(result.is_ok());
let prs = result.unwrap();
assert_eq!(prs.total_count, 2);
assert_eq!(prs.items.len(), 2);
let prs = result.expect("Failed to get pull requests");
assert_eq!(prs.total_count, 2);
assert_eq!(prs.items.len(), 2);
assert_eq!(prs.items.len(), 2);

Copilot uses AI. Check for mistakes.
@@ -19,19 +20,20 @@ pub struct PullRequestResponse {
/// PR title
pub title: String,
/// User information who opened the PR
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should read "User information for the user who opened the PR" or "Information about the user who opened the PR" for better grammar and clarity.

Suggested change
/// User information who opened the PR
/// User information for the user who opened the PR

Copilot uses AI. Check for mistakes.
let prs = result.expect("Failed to get pull requests");
assert_eq!(prs.total_count, 2);
assert_eq!(prs.items.len(), 2);
assert_eq!(prs.items.len(), 2);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate assertion replaces actual test coverage

Line 68 is a duplicate of line 67 (assert_eq!(prs.items.len(), 2)), while the original assertions for prs.items[0].title and prs.items[0].user.login were removed. This loses test coverage for validating that PR titles and user logins are correctly parsed from the API response. The duplicate assertion provides no additional value and appears to be an accidental copy-paste error.

Fix in CursorΒ Fix in Web

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


impl PullRequests {
pub async fn pull_requests_open() -> Result<(), reqwest::Error> {
/// Fetch all open pull requests
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation comment says "Fetch all open pull requests" but based on the implementation and the updated documentation for PullRequestItems.items, this method only fetches the first page of results due to pagination. Consider updating the comment to reflect this limitation, e.g., "Fetch open pull requests (paginated results)".

Suggested change
/// Fetch all open pull requests
/// Fetch open pull requests (first page of paginated results)

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@joaolfp joaolfp merged commit 65bb555 into main Jan 6, 2026
8 checks passed
@joaolfp joaolfp deleted the hotfix/fix-comments branch January 6, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants