Skip to content

Commit

Permalink
chore(opossum): Prefer add functions when building collections
Browse files Browse the repository at this point in the history
Avoid any confusion what `this` refers to for these (extension) functions.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Dec 16, 2024
1 parent 6db8eae commit 03d9166
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions model/src/main/kotlin/utils/SortedCollectionConverters.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ class SnippetFindingSortedSetConverter : StdConverter<Set<SnippetFinding>, Sorte

private fun Provenance.getSortKey(): String =
buildList {
this += javaClass.canonicalName
add(javaClass.canonicalName)

when (this@getSortKey) {
is RepositoryProvenance -> {
this += vcsInfo.type.toString()
this += vcsInfo.url
add(vcsInfo.type.toString())
add(vcsInfo.url)
}

is ArtifactProvenance -> {
this += sourceArtifact.url
add(sourceArtifact.url)
}

else -> {
Expand Down
2 changes: 1 addition & 1 deletion plugins/package-managers/conan/src/main/kotlin/Conan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class Conan(
val dependencies = parseDependencyTree(pkgInfos, pkgInfo.requires, workingDir) +
parseDependencyTree(pkgInfos, pkgInfo.buildRequires, workingDir)

this += PackageReference(id, dependencies = dependencies)
add(PackageReference(id, dependencies = dependencies))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,6 @@ class OpossumReporter(
private fun DependencyNode.getDependencies(): List<DependencyNode> =
buildList {
visitDependencies { dependencyNodes ->
this += dependencyNodes.map { it.getStableReference() }
addAll(dependencyNodes.map { it.getStableReference() })
}
}

0 comments on commit 03d9166

Please sign in to comment.