Fix version regex to prevent false matches on compound keys#61
Conversation
- Add negative lookbehind to prevent matching 'target-version', 'myversion', etc. - Add detailed inline comments explaining each regex component - Use pybump set --auto for unique test.pypi.org versions (commit SHA as release) Fixes #58 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #61 +/- ##
==========================================
+ Coverage 95.42% 95.52% +0.09%
==========================================
Files 5 5
Lines 459 469 +10
==========================================
+ Hits 438 448 +10
Misses 21 21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Review for PR #61: Fix version regex to prevent false matches on compound keysSummaryThis PR successfully addresses issue #58 by adding a negative lookbehind assertion to the version regex pattern, preventing false matches on compound keys like target-version or myversion. The implementation is solid and well-documented. ✅ Strengths
🔍 Potential IssuesMissing Test Coverage While the PR description mentions manual testing, there are no new automated tests in the test suite. The test files were not modified. Recommendation: Add automated tests for compound key scenarios to prevent regression:
Workflow Change Suggestion 🔒 Security & Performance✅ No security concerns ✅ Final VerdictApproval Status: Approve with minor recommendations The PR successfully: Risk Level: Low Great work on the fix and documentation! The implementation is sound. Adding automated test cases will make this PR excellent. |
- Add --metadata flag to 'set' command that works with --auto - When used, sets commit SHA as metadata (+sha) instead of release (-sha) - Fix version regex to prevent false matches on compound keys like 'target-version' - Update CI to use --auto --metadata for unique test.pypi.org versions Fixes #58 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review - PR #61: Fix version regex to prevent false matches on compound keysOverviewThis PR fixes issue #58 where PyBump incorrectly matched keys containing "version" as a substring (e.g., ✅ Code Quality and Best PracticesStrengths:
Suggestions:
🐛 Potential Bugs and IssuesCritical:
Minor:
⚡ Performance ConsiderationsGood:
No concerns - the changes have minimal performance impact. 🔒 Security ConcernsNo security issues identified. The changes are low-risk:
🧪 Test CoverageStrengths:
Gaps:
📋 Additional Recommendations
SummaryThis is a solid PR that fixes a real bug and adds useful functionality. The code quality is high, documentation is excellent, and the approach is sound. Before merging:
Estimated effort to address: Low - mostly adding test cases. Overall: Approved with minor suggestions ✅ Review generated with Claude Code |
- Add test data for pyproject.toml with compound keys (target-version, myversion) - Add test case verifying only 'version' matches, not 'target-version' or 'myversion' - Add test case verifying inline/indented version still works 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review: PR #61 - Fix version regex to prevent false matches on compound keysSummaryThis PR fixes issue #58 by improving the regex pattern to prevent matching compound keys like Code Quality & Best Practices ✅Strengths:
Potential Issues & Concerns1. Regex Edge Cases
|
Summary
(?<![a-zA-Z0-9_-])to prevent matching keys liketarget-version,myversion, etc.pybump set --autofor unique test.pypi.org versions (appends commit SHA as release)Test plan
target-version = "py312"this-is-a-version-containing-key = "1.1.7"__version__pattern)Fixes #58
🤖 Generated with Claude Code