refactor(config): Resolved previously finished TODO.
@@ -296,7 +296,6 @@ open class DetectConfigurationFactory(private val detectConfiguration: PropertyC
val additionalArguments = detectConfiguration.getPropertyWithDeprecations(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_ARGUMENTS, DetectProperties.DETECT_HUB_SIGNATURE_SCANNER_ARGUMENTS)
val maxDepth = detectConfiguration.getValue(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_EXCLUSION_PATTERN_SEARCH_DEPTH)
- // TODO: Switch data types from String to Path
val offlineLocalScannerInstallPath = detectConfiguration.getPropertyWithDeprecations(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_OFFLINE_LOCAL_PATH, DetectProperties.DETECT_HUB_SIGNATURE_SCANNER_OFFLINE_LOCAL_PATH)?.resolvePath(pathResolver)
val onlineLocalScannerInstallPath = detectConfiguration.getPropertyWithDeprecations(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_LOCAL_PATH, DetectProperties.DETECT_HUB_SIGNATURE_SCANNER_LOCAL_PATH)?.resolvePath(pathResolver)
val userProvidedScannerInstallUrl = detectConfiguration.getPropertyWithDeprecations(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_HOST_URL, DetectProperties.DETECT_HUB_SIGNATURE_SCANNER_HOST_URL)
@@ -304,10 +303,11 @@ open class DetectConfigurationFactory(private val detectConfiguration: PropertyC
if (offlineLocalScannerInstallPath != null && StringUtils.isNotBlank(userProvidedScannerInstallUrl)) {
throw DetectUserFriendlyException(
"You have provided both a Black Duck signature scanner url AND a local Black Duck signature scanner path. Only one of these properties can be set at a time. If both are used together, the *correct* source of the signature scanner can not be determined.",
- ExitCodeType.FAILURE_GENERAL_ERROR)
+ ExitCodeType.FAILURE_GENERAL_ERROR
+ )
}
- // TODO: Is this managing deprecated properties properly?
+ // TODO: Is this managing deprecated properties properly? Why is value unused?
val snippetMatching = detectConfiguration.getValue(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_SNIPPET_MATCHING)
fun fromSnippetExtended(value: ExtendedSnippetMode): SnippetMatching? {
return if (detectConfiguration.getValue(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_SNIPPET_MODE)) {
@@ -317,10 +317,11 @@ open class DetectConfigurationFactory(private val detectConfiguration: PropertyC
}
}
- var snippetMatchingEnum: SnippetMatching? = when (snippetMatching) {
+ val snippetMatchingEnum: SnippetMatching? = when (snippetMatching) {
is ExtendedValue -> fromSnippetExtended(snippetMatching.value)
is BaseValue -> snippetMatching.value
}
+
return BlackDuckSignatureScannerOptions(
signatureScannerPaths = signatureScannerPaths,
exclusionNamePatterns = exclusionNamePatterns,
