-
Notifications
You must be signed in to change notification settings - Fork 308
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
node: Port all remaining Jackson-based code to KxS #9125
Conversation
e360304
to
f1f6dc8
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9125 +/- ##
============================================
+ Coverage 67.14% 67.15% +0.01%
+ Complexity 1193 1191 -2
============================================
Files 239 239
Lines 7892 7898 +6
Branches 914 916 +2
============================================
+ Hits 5299 5304 +5
Misses 2225 2225
- Partials 368 369 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -146,7 +141,8 @@ class Yarn2( | |||
*/ | |||
private fun isCorepackEnabledInManifest(workingDir: File): Boolean = | |||
runCatching { | |||
PACKAGE_MANAGER_PROPERTY in jsonMapper.readTree(workingDir.resolve(MANIFEST_FILE)) | |||
val packageJson = parsePackageJson(workingDir.resolve(MANIFEST_FILE)) | |||
packageJson.packageManger.orEmpty().isNotBlank() |
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.
How about !packageJson.packageManger.isNullOrEmpty()
instead? There is also isNullOrBlank()
, but I'm not sure whether we need to cover the rather pathological blank case here.
when { | ||
type == YarnDependencyType.DEPENDENCIES -> dependencies | ||
else -> devDependencies | ||
} |
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.
Better use
when (type) {
YarnDependencyType.DEPENDENCIES -> dependencies
YarnDependencyType.DEV_DEPENDENCIES -> devDependencies
}
Kotlin will recognize that the when
is exhaustive, so no else
is needed.
@@ -61,8 +59,11 @@ import org.ossreviewtoolkit.plugins.packagemanagers.node.utils.mapNpmLicenses | |||
import org.ossreviewtoolkit.plugins.packagemanagers.node.utils.parseNpmAuthor | |||
import org.ossreviewtoolkit.plugins.packagemanagers.node.utils.parseNpmVcsInfo | |||
import org.ossreviewtoolkit.plugins.packagemanagers.node.utils.splitNpmNamespaceAndName | |||
import org.ossreviewtoolkit.plugins.packagemanagers.node.yarn2.Yarn2.Companion.YARN2_RESOURCE_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.
Commit message: Typo in .yarn*r*c.yml
.
val yarnPath = yarnConfig.get<YamlScalar>(YARN_PATH_PROPERTY_NAME)?.content.orEmpty().ifBlank { null } | ||
|
||
requireNotNull(yarnPath) { "No Yarn 2+ executable could be found in '$YARN2_RESOURCE_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.
While at it, maybe simplify to
val yarnPath = yarnConfig.get<YamlScalar>(YARN_PATH_PROPERTY_NAME)?.content
require(!yarnPath.isNullOrEmpty()) { "No Yarn 2+ executable could be found in '$YARN2_RESOURCE_FILE'." }
Again, I'm unsure whether we need to cover the pathological bank case.
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
f1f6dc8
to
7855479
Compare
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Separate the parsing of '.yarnrc.yml' a bit. Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
7855479
to
de0df1b
Compare
See individual commits.