File tree Expand file tree Collapse file tree
plugins/commands/requirements/src/main/kotlin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,26 +130,19 @@ class RequirementsCommand(
130130 fun Class <out Any >.isBundledPlugin (type : String ) =
131131 packageName.startsWith(" org.ossreviewtoolkit.plugins.$type ." )
132132
133- val kotlinObject = cliClass.kotlin.objectInstance
134-
135- val (instance, category) = when {
136- kotlinObject != null -> {
137- logger.debug { " $cliClass is a Kotlin object." }
138-
139- val category = when {
140- cliClass.isBundledPlugin(" packagemanagers" ) -> " PackageManager"
141- cliClass.isBundledPlugin(" scanners" ) -> " Scanner"
142- cliClass.isBundledPlugin(" versioncontrolsystems" ) -> " VersionControlSystem"
143- else -> " Other tool"
144- }
145-
146- kotlinObject to category
147- }
133+ val instance = cliClass.kotlin.objectInstance?.let {
134+ logger.debug { " $cliClass is a Kotlin object." }
135+ it
136+ } ? : run {
137+ logger.debug { " Trying to instantiate $cliClass without any arguments." }
138+ cliClass.getDeclaredConstructor().newInstance()
139+ }
148140
149- else -> {
150- logger.debug { " Trying to instantiate $cliClass without any arguments." }
151- cliClass.getDeclaredConstructor().newInstance() to " Other tool"
152- }
141+ val category = when {
142+ cliClass.isBundledPlugin(" packagemanagers" ) -> " PackageManager"
143+ cliClass.isBundledPlugin(" scanners" ) -> " Scanner"
144+ cliClass.isBundledPlugin(" versioncontrolsystems" ) -> " VersionControlSystem"
145+ else -> " Other tool"
153146 }
154147
155148 if (instance.command().isNotEmpty()) {
You can’t perform that action at this time.
0 commit comments