-
-
Notifications
You must be signed in to change notification settings - Fork 169
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
Refactor toml and lock file in cargo parsing using @iarna/toml
(#1592)
#1595
base: master
Are you sure you want to change the base?
Conversation
…oneDX#1592) Signed-off-by: Lizhe Lv <[email protected]>
// like `libc = 0.2.79` | ||
version = dependencyNode; | ||
} else if ( | ||
Object.prototype.toString.call(dependencyNode) === "[object Object]" |
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.
Shall we use Object.keys(dependencyNode).length
and the existing logic that use instanceOf
operator to determine string for consistency?
Object.prototype.toString.call(dependencyNode) === "[object Object]" | ||
) { | ||
// like `libc = { version = "0.2.79", features = ['rustc-dep-of-std'], default-features = false }` | ||
version = dependencyNode["version"]; |
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.
Do we need dependencyNode?.version and dependencyNode?.git here or are those values always present?
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.
Yes, the value of dependencyNode
always present here. But you're right, using dependencyNode?.version
can make the code less prone to exceptions.
// parse `[[package]]` | ||
if ( | ||
packageNode && | ||
Object.prototype.toString.call(packageNode) === "[object Array]" |
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.
Shall we use Array.isArray
here?
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.
Yes, using Array.isArray
would indeed be better here.
Looks very good. Just few minor comments. |
pkg.repository = { url: pkgRepository }; | ||
} | ||
if (pkgLicense) { | ||
pkg.license = pkgLicense; |
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.
Repotests is complaining about this line. Any ideas?
@prabhu Thank you so much for taking the time to review my code and provide such feedback. |
Looking forward to the updates. Will be a great improvement. |
No description provided.