Skip to content

Order PRs by number #491

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

Merged
merged 1 commit into from
Feb 28, 2025
Merged

Order PRs by number #491

merged 1 commit into from
Feb 28, 2025

Conversation

lucacome
Copy link
Owner

@lucacome lucacome commented Feb 28, 2025

This pull request includes changes to the groupDependencyUpdates function and its corresponding tests to improve the sorting of pull request (PR) numbers. The most important changes include updating test cases to reflect the new PR numbers and modifying the sorting logic in the groupDependencyUpdates function.

Changes to test cases:

Improvements to sorting logic:

  • src/notes.ts: Modified the groupDependencyUpdates function to sort PR numbers numerically rather than lexicographically, ensuring a proper numerical order in the consolidated entry.

Summary by CodeRabbit

  • Tests
    • Updated dependency update tests to reflect current reference information.
  • Refactor
    • Improved the ordering of update references through numerical sorting for enhanced clarity and consistency in the displayed release notes.

@Copilot Copilot AI review requested due to automatic review settings February 28, 2025 07:59
Copy link
Contributor

coderabbitai bot commented Feb 28, 2025

Walkthrough

This pull request updates the dependency update grouping logic and its tests. The test suite for groupDependencyUpdates now reflects updated pull request references and includes an additional update entry for the @types/node dependency. Additionally, the groupDependencyUpdates function in src/notes.ts has been modified to sort PR links numerically—extracting numbers via regex before joining them. There are no changes to exported or public entities.

Changes

File(s) Change Summary
tests/notes.test.ts Updated test cases for grouping dependency updates: replaced old PR references with new ones for @types/node and added an entry for version ^22.5.3.
src/notes.ts Modified groupDependencyUpdates to sort pull request links numerically by extracting PR numbers using a regex-based sorting mechanism.

Sequence Diagram(s)

sequenceDiagram
    participant T as Test Suite
    participant G as groupDependencyUpdates Function
    participant S as Sorting Routine

    T->>G: Call with dependency updates list
    G->>S: Extract PR numbers using regex
    S-->>G: Return sorted PR numbers
    G-->>T: Return consolidated, numerically sorted update string
Loading

Possibly related PRs

Poem

I'm a bunny, hopping through the code,
Updating references on every road.
PR numbers sorted, neat and clear,
With regex magic, they now appear.
Hop along with me in this code delight!
🐰✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 89013b0 and 153979a.

⛔ Files ignored due to path filters (2)
  • dist/index.js is excluded by !**/dist/**
  • dist/index.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (2)
  • __tests__/notes.test.ts (2 hunks)
  • src/notes.ts (1 hunks)
🔇 Additional comments (3)
src/notes.ts (1)

521-531: Improved PR sorting logic looks good!

The implementation properly sorts PR numbers numerically rather than lexicographically, which enhances readability of consolidated dependency updates. The regex extraction of PR numbers from URLs and numerical comparison are well implemented.

__tests__/notes.test.ts (2)

373-376: Test case updates align with the new PR sorting functionality.

The test now uses PR numbers (85, 169, 210) that better demonstrate numerical sorting versus lexicographical sorting, ensuring the functionality works as expected.


390-390: Expected result correctly reflects numerical PR sorting.

The expected output now shows PR numbers arranged in numerical order (85, 169, 210) rather than lexicographical order, correctly validating the implementation.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added bug Something isn't working tests labels Feb 28, 2025
Copy link

@Copilot 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.

PR Overview

This PR refines the sorting of pull request numbers within dependency update messages by modifying the sorting logic in groupDependencyUpdates and updating the corresponding test cases.

  • Updated sorting logic in src/notes.ts to sort PR numbers numerically rather than lexicographically.
  • Revised test cases in tests/notes.test.ts to reflect the new numerical ordering of PR numbers.

Reviewed Changes

File Description
src/notes.ts Updated sorting logic for consolidated PR entries using numeric sorting.
tests/notes.test.ts Modified expected PR number values and order in dependency update tests.

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

Comments suppressed due to low confidence (1)

tests/notes.test.ts:390

  • [nitpick] Ensure that additional test cases are added to cover edge cases for PR numbers that might not follow the common URL pattern so the numeric sorting remains robust.
* Update dependency @types/node to ^22.5.4 by @renovate in https://github.com/lucacome/draft-release/pull/85, https://github.com/lucacome/draft-release/pull/169, https://github.com/lucacome/draft-release/pull/210

@lucacome lucacome merged commit 903d87d into main Feb 28, 2025
15 checks passed
@lucacome lucacome deleted the fix/order-prs branch February 28, 2025 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant