- Notifications
You must be signed in to change notification settings - Fork14
Improve test coverage#462
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
sourcery-aibot commentedMar 8, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Reviewer's Guide by SourceryThis pull request adds a comprehensive 'about.md' document to the 'notes' directory. This document provides a detailed overview of the VCSPull project, covering its purpose, architecture, configuration, codebase structure, development practices, tooling, and usage. Class Diagram for VCSPull ConfigurationclassDiagram class ConfigFile { +str path +dict repos } class Repository { +str url +dict remotes } class VCSClient { +str vcs_type +str url +sync() } ConfigFile -- Repository : contains Repository -- VCSClient : usesFile-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess yourdashboard to:
Getting Help
|
codecovbot commentedMar 8, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## master #462 +/- ##===========================================- Coverage 78.98% 23.92% -55.07%=========================================== Files 8 10 +2 Lines 414 1045 +631 Branches 85 150 +65 ===========================================- Hits 327 250 -77- Misses 52 789 +737+ Partials 35 6 -29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Hey@tony - I've reviewed your changes - here's some feedback:
Overall Comments:
- This is a great overview of the project, but it's unclear how it improves test coverage as the title suggests.
Here's what I looked at during the review
- 🟢General issues: all looks good
- 🟢Security: all looks good
- 🟢Testing: all looks good
- 🟢Complexity: all looks good
- 🟢Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
45d442a to5be857cCompare02b87ec to3e3654bCompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
126baa7 to06fdc1fCompare| # Infer VCS from URL if not already set | ||
| if "vcs" not in repo_data and "url" in repo_data: | ||
| url = repo_data["url"] | ||
| if "github.com" in url or url.endswith(".git"): |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
github.com
Uh oh!
There was an error while loading.Please reload this page.
Show autofix suggestionHide autofix suggestion
Copilot Autofix
AI 9 months ago
To fix the problem, we need to replace the substring check with a more robust method that parses the URL and checks the hostname. Specifically, we should use theurlparse function from theurllib.parse module to extract the hostname and then check if it matches the expected domain.
- Import the
urlparsefunction from theurllib.parsemodule. - Replace the substring check with a parsed URL check.
- Ensure that the check handles arbitrary subdomain sequences correctly.
| @@ -13,3 +13,3 @@ | ||
| fromtypingimportAny,Optional | ||
| fromurllib.parseimporturlparse | ||
| importyaml | ||
| @@ -222,5 +222,6 @@ | ||
| url=repo_data["url"] | ||
| if"github.com"inurlorurl.endswith(".git"): | ||
| parsed_url=urlparse(url) | ||
| ifparsed_url.hostnameand (parsed_url.hostname=="github.com"orurl.endswith(".git")): | ||
| repo_data["vcs"]="git" | ||
| elif"bitbucket.org"inurlandnoturl.endswith(".git"): | ||
| elifparsed_url.hostnameandparsed_url.hostname=="bitbucket.org"andnoturl.endswith(".git"): | ||
| repo_data["vcs"]="hg" |
| url = repo_data["url"] | ||
| if "github.com" in url or url.endswith(".git"): | ||
| repo_data["vcs"] = "git" | ||
| elif "bitbucket.org" in url and not url.endswith(".git"): |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
bitbucket.org
Uh oh!
There was an error while loading.Please reload this page.
Show autofix suggestionHide autofix suggestion
Copilot Autofix
AI 9 months ago
To fix the problem, we need to ensure that the URL is properly parsed and validated to confirm that the host is exactly "bitbucket.org" and not just a substring within the URL. We can use theurlparse function from theurllib.parse module to parse the URL and then check the hostname.
- Parse the URL using
urlparse. - Extract the hostname from the parsed URL.
- Check if the hostname is exactly "bitbucket.org".
This change should be made in themigrate_v1_to_v2 function, specifically around the lines where the URL is being checked for "bitbucket.org".
| @@ -222,5 +222,6 @@ | ||
| url=repo_data["url"] | ||
| if"github.com"inurlorurl.endswith(".git"): | ||
| parsed_url=urlparse(url) | ||
| if"github.com"inparsed_url.hostnameorurl.endswith(".git"): | ||
| repo_data["vcs"]="git" | ||
| elif"bitbucket.org"inurlandnoturl.endswith(".git"): | ||
| elifparsed_url.hostname=="bitbucket.org"andnoturl.endswith(".git"): | ||
| repo_data["vcs"]="hg" |
982b920 to87e8c24Compare…odelswhy: Enhance test coverage and verification of configuration models through property-based testing,ensuring models behave correctly with a wide variety of inputs beyond specific examples.what:- Implement property-based testing using Hypothesis for configuration models- Create comprehensive test strategies for generating valid URLs, paths, and model instances- Add tests verifying serialization roundtrips and invariant properties- Ensure tests verify Repository, Settings, VCSPullConfig, LockFile, and LockedRepository models- Fix type annotations and linting issues in test files- Add Hypothesis dependency to development dependenciesrefs: Addresses "Property-Based Testing" item from TODO.md
…n loaderwhy: Enhance test coverage and reliability of the configuration system by implementingproperty-based testing with Hypothesis and comprehensive integration tests.what:- Created property-based tests for configuration loading, saving, and include resolution- Added test generators for repository URLs, paths, and configuration objects- Implemented integration tests for complete configuration workflow- Fixed circular include detection in resolve_includes to prevent infinite recursion- Added proper tracking of processed paths to avoid duplicated processing- Ensured all code follows project style guidelines and has proper type annotations- Improved test reliability with proper temporary file and directory handlingrefs: Completes "Property-Based Testing" section in notes/TODO.md
why: Facilitate user transition from old nested config format to new Pydantic v2 formatwhat:- Implement migration module to detect and convert configuration versions- Add CLI command with dry-run, backup, and color output options- Create comprehensive test suite with property-based testing- Write detailed migration guide for usersSee also: notes/proposals/01-config-format-structure.md
Uh oh!
There was an error while loading.Please reload this page.
Summary by Sourcery
Documentation: