File tree Expand file tree Collapse file tree 2 files changed +35
-7
lines changed
plugins/commands/analyzer/src/main/kotlin Expand file tree Collapse file tree 2 files changed +35
-7
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2022 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ *
16+ * SPDX-License-Identifier: Apache-2.0
17+ * License-Filename: LICENSE
18+ */
19+
20+ package org.ossreviewtoolkit.analyzer
21+
22+ import org.ossreviewtoolkit.model.config.AnalyzerConfiguration
23+
24+ /* *
25+ * Return the list of enabled [PackageManager]s based on the [AnalyzerConfiguration.enabledPackageManagers] and
26+ * [AnalyzerConfiguration.disabledPackageManagers] configuration properties and the
27+ * [default][PackageManagerFactory.isEnabledByDefault] of the [PackageManager]s.
28+ */
29+ fun AnalyzerConfiguration.determineEnabledPackageManagers (): Set <PackageManagerFactory > {
30+ val enabled = enabledPackageManagers?.mapNotNull { PackageManager .ALL [it] } ? : PackageManager .ENABLED_BY_DEFAULT
31+ val disabled = disabledPackageManagers?.mapNotNull { PackageManager .ALL [it] }.orEmpty()
32+
33+ return enabled.toSet() - disabled.toSet()
34+ }
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import org.apache.logging.log4j.kotlin.Logging
4040import org.ossreviewtoolkit.analyzer.Analyzer
4141import org.ossreviewtoolkit.analyzer.PackageManager
4242import org.ossreviewtoolkit.analyzer.PackageManagerFactory
43+ import org.ossreviewtoolkit.analyzer.determineEnabledPackageManagers
4344import org.ossreviewtoolkit.model.FileFormat
4445import org.ossreviewtoolkit.model.ResolvedPackageCurations.Companion.REPOSITORY_CONFIGURATION_PROVIDER_ID
4546import org.ossreviewtoolkit.model.config.AnalyzerConfiguration
@@ -235,10 +236,3 @@ class AnalyzerCommand : OrtCommand(
235236 severityStats.print ().conclude(ortConfig.severeIssueThreshold, 2 )
236237 }
237238}
238-
239- private fun AnalyzerConfiguration.determineEnabledPackageManagers (): Set <PackageManagerFactory > {
240- val enabled = enabledPackageManagers?.mapNotNull { PackageManager .ALL [it] } ? : PackageManager .ENABLED_BY_DEFAULT
241- val disabled = disabledPackageManagers?.mapNotNull { PackageManager .ALL [it] }.orEmpty()
242-
243- return enabled.toSet() - disabled.toSet()
244- }
You can’t perform that action at this time.
0 commit comments