Skip to content

tests(config-variations): Git schemes in repo URLs #490

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tony
Copy link
Member

@tony tony commented Apr 21, 2025

Related to vcs-python/vcspull#49, vcs-python/vcspull#426

In main repo URLs:

Main repo URLs require libvcs.url.git.GitURL support:

Scheme: [email protected]:org/repo.git
Example: [email protected]:tmux-python/tmuxp.git

Note: The workaround is to prepend git+ssh://[email protected]:tmux-python/tmuxp.git

Summary by Sourcery

Add support for detecting and parsing Git URLs with SCP-style syntax (e.g., [email protected]:org/repo.git) in the libvcs library

New Features:

  • Support for parsing unprefixed SSH-style Git URLs without requiring a 'git+ssh://' prefix

Enhancements:

  • Improve URL parsing to recognize SCP-style Git URL formats
  • Update URL validation to explicitly support Git URLs in SCP syntax

Tests:

  • Add test cases to verify detection of SCP-style Git URLs
  • Extend test coverage for create_project function with SCP-style Git URLs

… explicit VCS matches; update docs, tests, and create_project overloads
Copy link

sourcery-ai bot commented Apr 21, 2025

Reviewer's Guide by Sourcery

This pull request adds support for parsing Git URLs in the SCP format (e.g., [email protected]:user/repo.git). The changes involve updating the Git URL regex, the GitURL class, and the URL registry to correctly handle SCP-style URLs. Additionally, a test case has been added to verify the functionality.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Added support for parsing Git URLs in the SCP format (e.g., [email protected]:user/repo.git).
  • Added a test case to verify that create_project infers Git VCS for SCP-style URLs.
  • Updated the Git URL regex to include SCP-style URLs.
  • Updated the GitURL class to correctly validate SCP-style URLs.
  • Updated the URL registry to correctly match SCP-style URLs.
src/libvcs/_internal/shortcuts.py
tests/test_shortcuts.py
src/libvcs/url/git.py
docs/url/registry.md
tests/url/test_registry.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

codecov bot commented Apr 21, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 54.32%. Comparing base (6418d32) to head (815440d).

Files with missing lines Patch % Lines
src/libvcs/_internal/shortcuts.py 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #490      +/-   ##
==========================================
+ Coverage   54.09%   54.32%   +0.22%     
==========================================
  Files          40       40              
  Lines        3627     3634       +7     
  Branches      793      794       +1     
==========================================
+ Hits         1962     1974      +12     
+ Misses       1314     1306       -8     
- Partials      351      354       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @tony - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a test case with is_explicit=False to ensure the regex patterns work as expected without explicit matching.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -68,6 +68,17 @@ def create_project(
) -> HgSync: ...


@t.overload
Copy link

Choose a reason for hiding this comment

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

issue (complexity): Consider using a single function signature with union types to reduce overload duplication and simplify the API while maintaining functionality

You can reduce overload duplication by declaring a single function signature that uses the union types for both the parameter and the return value. For example, remove the extra overload and use this unified signature:

def create_project(
    *,
    url: str,
    path: StrPath,
    vcs: VCSLiteral | None = None,
    progress_callback: ProgressCallbackProtocol | None = None,
    **kwargs: t.Any,
) -> GitSync | HgSync | SvnSync:
    ...

This minimizes duplicate parameters and keeps the API clear while preserving all functionality.

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.

1 participant