-
Notifications
You must be signed in to change notification settings - Fork 73
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
fix: duplicate_package_checker panic when package.json has no version field #1634
Conversation
Walkthrough本次更改对 Changes
Assessment against linked issues
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
crates/mako/src/plugins/duplicate_package_checker.rs (1)
106-114
: 版本解析逻辑改进,但可以考虑添加错误日志这个改动很好地解决了当
package.json
中缺少版本字段时的崩溃问题。通过在创建PackageInfo
实例之前检查版本解析是否成功,代码变得更加健壮。建议:
考虑在版本解析失败时添加一条警告日志,以便于调试和问题追踪。例如:if let Ok(version) = version { let package_info = PackageInfo { name, version, path: package_json.path.clone(), }; packages.push(package_info); } else { log::warn!("Failed to parse version for package: {}", name); }这样可以在不中断程序执行的情况下,为开发者提供有用的调试信息。
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1634 +/- ##
=======================================
Coverage 55.66% 55.67%
=======================================
Files 172 172
Lines 17294 17296 +2
=======================================
+ Hits 9627 9629 +2
Misses 7667 7667 ☔ View full report in Codecov by Sentry. |
Close #1632
Summary by CodeRabbit
Bug Fixes
Style