Conversation
Introduces a dedicated helper to determine the target configuration file path. Allows direct specification of TOML files in addition to inferring `pyproject.toml` from a directory. This change centralizes and deduplicates path construction logic across GitHub, GitLab, and local fetching functions, improving clarity and flexibility.
Reviewer's GuideRefactors configuration path resolution so that GitHub, GitLab, and local git-clone fetchers share a single helper that can resolve either directory-based pyproject.toml paths or explicit TOML file paths. Flow diagram for _get_target_path helper logicflowchart TD
A[start _get_target_path path] --> B{path is not None?}
B -- no --> C[return pyproject.toml]
B -- yes --> D{path endswith .toml?}
D -- yes --> E[strip trailing slashes from path]
E --> F[return stripped path]
D -- no --> G[strip trailing slashes from path]
G --> H[append /pyproject.toml]
H --> I[return combined path]
Flow diagram for shared configuration target path resolutionflowchart TD
subgraph Callers
A[_convert_github_url] --> D[_get_target_path]
B[_convert_gitlab_url] --> D
C[_git_clone_and_read] --> D
end
D --> E[resolved_target_path]
E --> F[GitHub raw URL path construction]
E --> G[GitLab raw URL path construction]
E --> H[Local pathlib.Path creation]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #89 +/- ##
==========================================
- Coverage 90.48% 90.38% -0.11%
==========================================
Files 1 1
Lines 410 447 +37
==========================================
+ Hits 371 404 +33
- Misses 39 43 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
_get_target_path, consider usingpathlib.PurePosixPath(or at least normalizing via URL-style joins) instead of manualstrip('/')and string concatenation to avoid subtle path edge cases and make the URL path handling more robust. - The
.endswith('.toml')check in_get_target_pathis case-sensitive; if you want to support configuration files with different TOML filename casing, you may want to normalize the extension before checking.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `_get_target_path`, consider using `pathlib.PurePosixPath` (or at least normalizing via URL-style joins) instead of manual `strip('/')` and string concatenation to avoid subtle path edge cases and make the URL path handling more robust.
- The `.endswith('.toml')` check in `_get_target_path` is case-sensitive; if you want to support configuration files with different TOML filename casing, you may want to normalize the extension before checking.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ba0b101 to
fc37e91
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refactors remote configuration path resolution and enhances error handling with proactive suggestions.
Changes
_get_target_pathto centralize and deduplicate logic across GitHub, GitLab, and local fetching..tomlfiles in addition to inferringpyproject.tomlfrom a directory.ruff-sync pullcommand as an alternative.to_git_urlto handle browser-to-git URL transformations.0.0.5.dev1.