-
Notifications
You must be signed in to change notification settings - Fork 11
git init
compatibility, Git.version()
#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
base: master
Are you sure you want to change the base?
Conversation
Reviewer's GuideThis pull request introduces a vendorized version parsing module to enable uniform Git version comparison and improve Class Diagram for Structure Types (_structures.py)classDiagram
class InfinityType {
+__repr__() str
+__hash__() int
+__lt__(other: object) bool
+__le__(other: object) bool
+__eq__(other: object) bool
+__gt__(other: object) bool
+__ge__(other: object) bool
+__neg__() NegativeInfinityType
}
class NegativeInfinityType {
+__repr__() str
+__hash__() int
+__lt__(other: object) bool
+__le__(other: object) bool
+__eq__(other: object) bool
+__gt__(other: object) bool
+__ge__(other: object) bool
+__neg__() InfinityType
}
note "Defines Infinity and NegativeInfinity types and instances (Infinity, NegativeInfinity) used in version comparison logic."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #491 +/- ##
==========================================
+ Coverage 54.09% 55.59% +1.50%
==========================================
Files 40 42 +2
Lines 3627 3921 +294
Branches 793 823 +30
==========================================
+ Hits 1962 2180 +218
- Misses 1314 1375 +61
- Partials 351 366 +15 ☔ 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 and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: 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.
When stuck in debugging loops: | ||
|
||
1. **Pause and acknowledge the loop** | ||
2. **Minimize to MVP**: Remove all debugging cruft and experimental code |
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.
issue (typo): Potential Markdown formatting typo.
There's an extra asterisk in MVP**:
. For proper bolding use **MVP**:
.
2. **Minimize to MVP**: Remove all debugging cruft and experimental code | |
2. Minimize to **MVP**: Remove all debugging cruft and experimental code |
"""Take a string like abc.1.twelve and turns it into ("abc", 1, "twelve").""" | ||
if local is not None: | ||
return tuple( | ||
part.lower() if not part.isdigit() else int(part) |
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.
suggestion (code-quality): Swap if/else branches of if expression to remove negation (swap-if-expression
)
part.lower() if not part.isdigit() else int(part) | |
int(part) if part.isdigit() else part.lower() |
Explanation
Negated conditions are more difficult to read than positive ones, so it is bestto avoid them where we can. By swapping the
if
and else
conditions around wecan invert the condition and make it positive.
if not letter and number: | ||
# We assume if we are given a number, but we are not given a letter | ||
# then this is using the implicit post release syntax (e.g. 1.0-1) | ||
letter = "post" | ||
|
||
return letter, int(number) | ||
|
||
return None |
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.
suggestion (code-quality): We've found these issues:
- Remove redundant conditional (
remove-redundant-if
) - Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
) - Inline variable that is only used once (
inline-variable
)
if not letter and number: | |
# We assume if we are given a number, but we are not given a letter | |
# then this is using the implicit post release syntax (e.g. 1.0-1) | |
letter = "post" | |
return letter, int(number) | |
return None | |
return ("post", int(number)) if number else None |
pre_ = pre | ||
|
||
# Versions without a post segment should sort before those with one. | ||
if post is None: |
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.
issue (code-quality): Replace if statement with if expression [×2] (assign-if-exp
)
97f05af
to
0698864
Compare
- Add GitVersionInfo dataclass to provide structured git version output - Update version() method to return raw string output - Add build_options() method that returns a GitVersionInfo instance - Fix doctests in vendored version module - Use internal vendor.version module instead of external packaging
0698864
to
544534a
Compare
Problem
git init
compatibility issuesgit --version
Details
Summary by Sourcery
Improve git compatibility by introducing internal version parsing utilities and updating documentation with project standards and workflows.
New Features:
Enhancements:
Documentation: