Skip to content

Commit 7d595d1

Browse files
committed
style(package-managers): Trivially align setContext() functions
Align the style of `setContext()` functions and related variables in dependency handlers a bit to follow a similar pattern and ordering. Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
1 parent 50e5910 commit 7d595d1

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

plugins/package-managers/cocoapods/src/main/kotlin/PodDependencyHandler.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ import org.ossreviewtoolkit.utils.common.div
3939
import org.ossreviewtoolkit.utils.common.searchUpwardFor
4040

4141
internal class PodDependencyHandler : DependencyHandler<Lockfile.Pod> {
42+
private lateinit var lockfile: Lockfile
4243
private val podspecCache = mutableMapOf<String, Podspec>()
4344
private val podsForName = mutableMapOf<String, Lockfile.Pod>()
44-
private lateinit var lockfile: Lockfile
4545

4646
fun setContext(lockfile: Lockfile) {
47+
this.lockfile = lockfile
48+
4749
// The cache entries are not re-usable across definition files because the keys do not contain the
4850
// dependency version. If non-default Specs repositories were supported, then these would also need to
4951
// be part of the key. As that's more complicated and not giving much performance prefer the more memory
@@ -52,7 +54,6 @@ internal class PodDependencyHandler : DependencyHandler<Lockfile.Pod> {
5254
podsForName.clear()
5355

5456
lockfile.pods.associateByTo(podsForName) { it.name }
55-
this.lockfile = lockfile
5657
}
5758

5859
override fun identifierFor(dependency: Lockfile.Pod): Identifier =

plugins/package-managers/gleam/src/main/kotlin/GleamDependencyHandler.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ internal class GleamDependencyHandler : DependencyHandler<GleamPackageInfo> {
3434

3535
fun setContext(context: GleamProjectContext) {
3636
this.context = context
37+
3738
manifestPackagesByName.apply {
3839
clear()
3940
context.manifest.packages.associateByTo(this) { it.name }

plugins/package-managers/node/src/main/kotlin/yarn/YarnDependencyHandler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ import org.ossreviewtoolkit.plugins.packagemanagers.node.parsePackageJson
3636
internal class YarnDependencyHandler(
3737
private val moduleInfoResolver: ModuleInfoResolver
3838
) : DependencyHandler<YarnListNode> {
39+
private lateinit var workingDir: File
40+
private val projectDirs = mutableSetOf<File>()
3941
private val packageJsonForModuleId = mutableMapOf<String, PackageJson>()
4042
private val moduleDirForModuleId = mutableMapOf<String, File>()
41-
private val projectDirs = mutableSetOf<File>()
42-
private lateinit var workingDir: File
4343

4444
fun setContext(workingDir: File, moduleDirs: Set<File>, projectDirs: Set<File>) {
4545
this.workingDir = workingDir

plugins/package-managers/node/src/main/kotlin/yarn2/Yarn2DependencyHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ import org.ossreviewtoolkit.plugins.packagemanagers.node.parsePackage
3434
internal class Yarn2DependencyHandler(
3535
private val moduleInfoResolver: ModuleInfoResolver
3636
) : DependencyHandler<PackageInfo> {
37+
private lateinit var workingDir: File
3738
private val packageJsonForModuleId = mutableMapOf<String, PackageJson>()
3839
private val packageInfoForLocator = mutableMapOf<String, PackageInfo>()
39-
private lateinit var workingDir: File
4040

4141
fun setContext(
4242
workingDir: File,

0 commit comments

Comments
 (0)