-
Notifications
You must be signed in to change notification settings - Fork 74
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
Sonar cloud fixes for 9.5 #1077
Changes from 4 commits
640a917
5ef3911
066eedf
bcc98a1
711a730
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,7 +134,7 @@ private DependencyGraph buildGraphForProject( | |
if (shouldInclude(entryName, entry.getVersion())) { | ||
LazyId id = generateComponentDependencyId(entryName, entry.getVersion()); | ||
graphBuilder.setDependencyInfo(id, entryName, entry.getVersion(), generateComponentExternalId(entryName, entry.getVersion())); | ||
ExternalIdDependencyGraphBuilder.LazyDependencyInfo parentInfo = graphBuilder.checkAndHandleMissingExternalId(lazyBuilderHandler, id); | ||
LazyExternalIdDependencyGraphBuilder.LazyDependencyInfo parentInfo = graphBuilder.checkAndHandleMissingExternalId(lazyBuilderHandler, id); | ||
Dependency parent = new Dependency(parentInfo.getName(), parentInfo.getVersion(), parentInfo.getExternalId(), null); | ||
mutableDependencyGraph.addDirectDependency(parent); | ||
collectYarnDependencies(lazyBuilderHandler, graphBuilder, mutableDependencyGraph, yarnLockResult, entry, resolvedEntryIdVersionMap, parent); | ||
|
@@ -176,20 +176,23 @@ private void collectYarnDependencies( | |
dependencyVersion = dependency.getVersion(); | ||
} | ||
LazyId stringDependencyId = generateComponentDependencyId(dependency.getName(), dependencyVersion); | ||
if (yarnDependencyTypeFilter.shouldInclude(YarnDependencyType.NON_PRODUCTION) || !dependency.isOptional()) { | ||
graphBuilder.setDependencyInfo(stringDependencyId, dependency.getName(), dependencyVersion, generateComponentExternalId(dependency.getName(), dependencyVersion)); | ||
//graphBuilder.addChildWithParent(stringDependencyId, id); | ||
LazyDependencyInfo childInfo = graphBuilder.checkAndHandleMissingExternalId(lazyBuilderHandler, stringDependencyId); | ||
Dependency child = new Dependency(childInfo.getName(), childInfo.getVersion(), childInfo.getExternalId(), null); | ||
mutableDependencyGraph.addChildWithParent(child, parent); | ||
|
||
} else { | ||
logger.trace("Excluding optional dependency: {}", stringDependencyId); | ||
} | ||
moveToMethod(dependency, dependencyVersion, parent,lazyBuilderHandler, graphBuilder, mutableDependencyGraph, stringDependencyId); | ||
} | ||
} | ||
} | ||
|
||
private void moveToMethod(YarnLockDependency dependency, String dependencyVersion, Dependency parent, LazyBuilderMissingExternalIdHandler lazyBuilderHandler, ExternalIdDependencyGraphBuilder graphBuilder, BasicDependencyGraph mutableDependencyGraph,LazyId stringDependencyId) throws MissingExternalIdException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gopannabd Moved last if block to a method, please suggest an appropriate name. Also, please review for any issues that may not be obvious to someone without context into this method ... such as whether or not passing the relevant objects around via parameters could cause any issues or not.. etc). In general I lack context into this area of the code, let me know what you think overall. Sonar issue: https://sonarcloud.io/project/issues?open=AY36qfWcZptyxDnuTZGc&id=com.synopsys.integration%3Asynopsys-detect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. includeNonProductionOrOptionalIfNeeded(...) |
||
if (yarnDependencyTypeFilter.shouldInclude(YarnDependencyType.NON_PRODUCTION) || !dependency.isOptional()) { | ||
graphBuilder.setDependencyInfo(stringDependencyId, dependency.getName(), dependencyVersion, generateComponentExternalId(dependency.getName(), dependencyVersion)); | ||
LazyDependencyInfo childInfo = graphBuilder.checkAndHandleMissingExternalId(lazyBuilderHandler, stringDependencyId); | ||
Dependency child = new Dependency(childInfo.getName(), childInfo.getVersion(), childInfo.getExternalId(), null); | ||
mutableDependencyGraph.addChildWithParent(child, parent); | ||
|
||
} else { | ||
logger.trace("Excluding optional dependency: {}", stringDependencyId); | ||
} | ||
} | ||
|
||
private boolean isWorkspace(YarnWorkspaces yarnWorkspaces, YarnLockDependency dependency) { | ||
Optional<YarnWorkspace> dependencyWorkspace = yarnWorkspaces.lookup(dependency); | ||
return dependencyWorkspace.isPresent(); | ||
|
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.
Related sonar cloud failure: https://sonarcloud.io/project/issues?open=AY3s6h72MlpV5xQqWqXG&id=com.synopsys.integration%3Asynopsys-detect