Skip to content

Commit 87fd707

Browse files
committed
refactor(model): Use named arguments in a couple of constructor calls
Improve readability, and while at it make use of the default value for scope roots in two of the calls. Signed-off-by: Frank Viernau <[email protected]>
1 parent 3f2a0eb commit 87fd707

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

analyzer/src/test/kotlin/AnalyzerResultBuilderTest.kt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,17 @@ class AnalyzerResultBuilderTest : WordSpec() {
103103
DependencyGraph.qualifyScope(project2, "scope-3") to listOf(RootDependencyIndex(0))
104104
)
105105

106-
private val graph1 =
107-
DependencyGraph(
108-
dependencies1,
109-
sortedSetOf(DependencyGraph.DEPENDENCY_REFERENCE_COMPARATOR, depRef1, depRef2),
110-
scopeMapping1
111-
)
112-
private val graph2 =
113-
DependencyGraph(
114-
dependencies2,
115-
sortedSetOf(DependencyGraph.DEPENDENCY_REFERENCE_COMPARATOR, depRef3),
116-
scopeMapping2
117-
)
106+
private val graph1 = DependencyGraph(
107+
packages = dependencies1,
108+
scopeRoots = sortedSetOf(DependencyGraph.DEPENDENCY_REFERENCE_COMPARATOR, depRef1, depRef2),
109+
scopes = scopeMapping1
110+
)
111+
112+
private val graph2 = DependencyGraph(
113+
packages = dependencies2,
114+
scopeRoots = sortedSetOf(DependencyGraph.DEPENDENCY_REFERENCE_COMPARATOR, depRef3),
115+
scopes = scopeMapping2
116+
)
118117

119118
private val analyzerResult1 = ProjectAnalyzerResult(
120119
project1, setOf(package1), listOf(issue3, issue4)

model/src/main/kotlin/utils/DependencyGraphBuilder.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,10 @@ class DependencyGraphBuilder<D>(
171171
val (nodes, edges) = references.toGraph(indexMapping)
172172

173173
return DependencyGraph(
174-
sortedDependencyIds,
175-
sortedSetOf(),
176-
constructSortedScopeMappings(scopeMapping, indexMapping),
177-
nodes,
178-
edges.removeCycles()
174+
packages = sortedDependencyIds,
175+
scopes = constructSortedScopeMappings(scopeMapping, indexMapping),
176+
nodes = nodes,
177+
edges = edges.removeCycles()
179178
)
180179
}
181180

model/src/test/kotlin/DependencyGraphTest.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ class DependencyGraphTest : WordSpec({
154154
"s2" to listOf(RootDependencyIndex(2, fragment = 1))
155155
)
156156

157-
val graph = DependencyGraph(ids, sortedSetOf(), scopeMap, nodes, edges)
157+
val graph = DependencyGraph(
158+
packages = ids,
159+
scopes = scopeMap,
160+
nodes = nodes,
161+
edges = edges
162+
)
158163
val scopes = graph.createScopes()
159164

160165
scopeDependencies(scopes, "s1") shouldBe "${ids[2]}<${ids[1]}${ids[0]}>"

model/src/test/kotlin/ProjectTest.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ private fun createDependencyGraph(qualified: Boolean = false): DependencyGraph {
7777
plainScopeMapping
7878
}
7979

80-
return DependencyGraph(dependencies, sortedSetOf(exampleRef, csvRef), scopeMapping)
80+
return DependencyGraph(
81+
packages = dependencies,
82+
scopeRoots = sortedSetOf(exampleRef, csvRef),
83+
scopes = scopeMapping
84+
)
8185
}
8286

8387
class ProjectTest : WordSpec({

0 commit comments

Comments
 (0)