Skip to content

Commit

Permalink
refactor(plugins-api)!: Rename PluginDescriptor.name to displayName
Browse files Browse the repository at this point in the history
The new name makes the purpose of the property clearer.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
  • Loading branch information
mnonnenmacher committed Sep 2, 2024
1 parent b42f894 commit 9b13596
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion advisor/src/main/kotlin/Advisor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Advisor(

logger.info {
"Found ${providerResults.values.flatMap { it.vulnerabilities }.distinct().size} distinct " +
"vulnerabilities via ${provider.descriptor.name}. "
"vulnerabilities via ${provider.descriptor.displayName}. "
}

providerResults.keys.takeIf { it.isNotEmpty() }?.let { pkgs ->
Expand Down
2 changes: 1 addition & 1 deletion plugins/advisors/nexus-iq/src/main/kotlin/NexusIq.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class NexusIq(override val descriptor: PluginDescriptor, private val config: Nex
component.packageUrl to ComponentDetails(component, SecurityData(emptyList()))
}

issues += Issue(source = descriptor.name, message = it.collectMessages())
issues += Issue(source = descriptor.displayName, message = it.collectMessages())
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/advisors/oss-index/src/main/kotlin/OssIndex.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class OssIndex(override val descriptor: PluginDescriptor, config: OssIndexConfig
ComponentReport(purl, reference = "", vulnerabilities = emptyList())
}

issues += Issue(source = descriptor.name, message = it.collectMessages())
issues += Issue(source = descriptor.displayName, message = it.collectMessages())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class VulnerableCode(override val descriptor: PluginDescriptor, config: Vulnerab
// issues that are not associated to any package.
allVulnerabilities += chunk.associateWith { emptyList() }

issues += Issue(source = descriptor.name, message = it.collectMessages())
issues += Issue(source = descriptor.displayName, message = it.collectMessages())

logger.error {
"The request of chunk ${index + 1} of ${chunks.size} failed for the following ${chunk.size} " +
Expand Down Expand Up @@ -161,7 +161,11 @@ class VulnerableCode(override val descriptor: PluginDescriptor, config: Vulnerab
VulnerabilityReference(sourceUri, it.scoringSystem, severity)
}
}.onFailure {
issues += createAndLogIssue(descriptor.name, "Failed to map $this to ORT model due to $it.", Severity.HINT)
issues += createAndLogIssue(
descriptor.displayName,
"Failed to map $this to ORT model due to $it.",
Severity.HINT
)
}.getOrElse { emptyList() }

/**
Expand Down
4 changes: 2 additions & 2 deletions plugins/api/src/main/kotlin/PluginDescriptor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ package org.ossreviewtoolkit.plugins.api
*/
data class PluginDescriptor(
/**
* The name of the plugin. Must be unique among all plugins for the same factory class.
* The display name of the plugin. Must be unique among all plugins for the same factory class.
*/
val name: String,
val displayName: String,

/**
* The name of the plugin class.
Expand Down
2 changes: 1 addition & 1 deletion plugins/compiler/src/main/kotlin/JsonSpecGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class JsonSpecGenerator(private val codeGenerator: CodeGenerator) {
fun generate(pluginSpec: PluginSpec) {
val jsonObject = buildJsonObject {
putJsonObject("descriptor") {
put("name", pluginSpec.descriptor.name)
put("displayName", pluginSpec.descriptor.displayName)
put("className", pluginSpec.descriptor.className)
put("description", pluginSpec.descriptor.description)

Expand Down
4 changes: 2 additions & 2 deletions plugins/compiler/src/main/kotlin/PluginFactoryGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ class PluginFactoryGenerator(private val codeGenerator: CodeGenerator) {
add(
"""
PluginDescriptor(
name = %S,
displayName = %S,
className = %S,
description = %S,
options = listOf(
""".trimIndent(),
descriptor.name,
descriptor.displayName,
descriptor.className,
descriptor.description
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/compiler/src/main/kotlin/PluginSpecFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class PluginSpecFactory {
return PluginSpec(
containingFile = pluginClass.containingFile,
descriptor = PluginDescriptor(
name = ortPlugin.name,
displayName = ortPlugin.name,
className = pluginClass.simpleName.asString(),
description = ortPlugin.description,
options = pluginOptions
Expand Down

0 comments on commit 9b13596

Please sign in to comment.