From 4596888e99fe5ead8cdcd8581349532a5c574826 Mon Sep 17 00:00:00 2001 From: Martin Nonnenmacher Date: Thu, 7 Nov 2024 21:18:32 +0100 Subject: [PATCH] refactor(reporter)!: Remove the unused `config` argument All reporters have been migrated to receive their configuration options via the constructor, so remove the now unused `config` argument from the `generateReport` function. Signed-off-by: Martin Nonnenmacher --- .../src/main/kotlin/ReporterCommand.kt | 2 +- .../aosd/src/main/kotlin/Aosd2Reporter.kt | 7 +------ .../main/kotlin/AsciiDocTemplateReporter.kt | 7 +------ .../main/kotlin/CtrlXAutomationReporter.kt | 7 +------ .../src/main/kotlin/CycloneDxReporter.kt | 17 ++++++--------- .../src/main/kotlin/EvaluatedModelReporter.kt | 11 +++------- .../fossid/src/main/kotlin/FossIdReporter.kt | 17 ++++++--------- .../src/main/kotlin/FossIdSnippetReporter.kt | 7 +------ .../main/kotlin/PlainTextTemplateReporter.kt | 9 ++------ .../main/kotlin/GitLabLicenseModelReporter.kt | 9 ++------ .../src/main/kotlin/OpossumReporter.kt | 9 ++------ .../src/main/kotlin/SpdxDocumentReporter.kt | 21 +++++++------------ .../src/main/kotlin/StaticHtmlReporter.kt | 7 +------ .../src/main/kotlin/TrustSourceReporter.kt | 7 +------ .../web-app/src/main/kotlin/WebAppReporter.kt | 9 ++------ reporter/src/main/kotlin/Reporter.kt | 13 ++++-------- 16 files changed, 42 insertions(+), 117 deletions(-) diff --git a/plugins/commands/reporter/src/main/kotlin/ReporterCommand.kt b/plugins/commands/reporter/src/main/kotlin/ReporterCommand.kt index b72c7a5f262c6..5e82cc5816822 100644 --- a/plugins/commands/reporter/src/main/kotlin/ReporterCommand.kt +++ b/plugins/commands/reporter/src/main/kotlin/ReporterCommand.kt @@ -295,7 +295,7 @@ class ReporterCommand : OrtCommand( reporter to measureTimedValue { val options = reportConfigMap[reporter.descriptor.id] ?: PluginConfiguration.EMPTY reporter.create(PluginConfig(options.options, options.secrets)) - .generateReport(input, outputDir, options) + .generateReport(input, outputDir) } } }.awaitAll() diff --git a/plugins/reporters/aosd/src/main/kotlin/Aosd2Reporter.kt b/plugins/reporters/aosd/src/main/kotlin/Aosd2Reporter.kt index fefe06e25529c..54dd7f846d3c8 100644 --- a/plugins/reporters/aosd/src/main/kotlin/Aosd2Reporter.kt +++ b/plugins/reporters/aosd/src/main/kotlin/Aosd2Reporter.kt @@ -27,7 +27,6 @@ import org.ossreviewtoolkit.model.HashAlgorithm import org.ossreviewtoolkit.model.Package import org.ossreviewtoolkit.model.RemoteArtifact import org.ossreviewtoolkit.model.RepositoryProvenance -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.model.licenses.LicenseView import org.ossreviewtoolkit.plugins.api.OrtPlugin import org.ossreviewtoolkit.plugins.api.PluginDescriptor @@ -44,11 +43,7 @@ import org.ossreviewtoolkit.utils.spdx.SpdxLicense factory = ReporterFactory::class ) class Aosd2Reporter(override val descriptor: PluginDescriptor = Aosd2ReporterFactory.descriptor) : Reporter { - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { + override fun generateReport(input: ReporterInput, outputDir: File): List> { val reportFiles = input.ortResult.getProjects(omitExcluded = true).map { project -> val directDependencies = input.ortResult.getDependencies(project.id, maxLevel = 1, omitExcluded = true) .map { it.toCoordinates() } diff --git a/plugins/reporters/asciidoc/src/main/kotlin/AsciiDocTemplateReporter.kt b/plugins/reporters/asciidoc/src/main/kotlin/AsciiDocTemplateReporter.kt index f7e58480d0aed..dd12420ccf4de 100644 --- a/plugins/reporters/asciidoc/src/main/kotlin/AsciiDocTemplateReporter.kt +++ b/plugins/reporters/asciidoc/src/main/kotlin/AsciiDocTemplateReporter.kt @@ -26,7 +26,6 @@ import org.asciidoctor.Attributes import org.asciidoctor.Options import org.asciidoctor.SafeMode -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.plugins.api.OrtPluginOption import org.ossreviewtoolkit.plugins.reporters.freemarker.FreemarkerTemplateProcessor import org.ossreviewtoolkit.reporter.Reporter @@ -85,11 +84,7 @@ abstract class AsciiDocTemplateReporter(private val config: AsciiDocTemplateRepo */ protected open fun generateAsciiDocAttributes(outputDir: File): Attributes = Attributes.builder().build() - final override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { + final override fun generateReport(input: ReporterInput, outputDir: File): List> { val asciiDocOutputDir = createOrtTempDir("asciidoc") val asciidoctorAttributes = generateAsciiDocAttributes(asciiDocOutputDir) diff --git a/plugins/reporters/ctrlx/src/main/kotlin/CtrlXAutomationReporter.kt b/plugins/reporters/ctrlx/src/main/kotlin/CtrlXAutomationReporter.kt index 819dae0970a30..6634fb8d668f2 100644 --- a/plugins/reporters/ctrlx/src/main/kotlin/CtrlXAutomationReporter.kt +++ b/plugins/reporters/ctrlx/src/main/kotlin/CtrlXAutomationReporter.kt @@ -24,7 +24,6 @@ import java.io.File import kotlinx.serialization.json.Json import kotlinx.serialization.json.encodeToStream -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.model.licenses.LicenseView import org.ossreviewtoolkit.plugins.api.OrtPlugin import org.ossreviewtoolkit.plugins.api.PluginDescriptor @@ -53,11 +52,7 @@ class CtrlXAutomationReporter(override val descriptor: PluginDescriptor = CtrlXA ) } - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { + override fun generateReport(input: ReporterInput, outputDir: File): List> { val packages = input.ortResult.getPackages(omitExcluded = true) val components = packages.mapTo(mutableListOf()) { (pkg, _) -> val qualifiedName = when (pkg.id.type) { diff --git a/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt b/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt index f9ee709205c0b..dd3342dc98a4c 100644 --- a/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt +++ b/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt @@ -45,7 +45,6 @@ import org.ossreviewtoolkit.model.Identifier import org.ossreviewtoolkit.model.LicenseSource import org.ossreviewtoolkit.model.Package import org.ossreviewtoolkit.model.Project -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.model.licenses.ResolvedLicenseInfo import org.ossreviewtoolkit.model.utils.toPurl import org.ossreviewtoolkit.model.vulnerabilities.Vulnerability @@ -171,21 +170,17 @@ class CycloneDxReporter( } } - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { + override fun generateReport(input: ReporterInput, outputDir: File): List> { val reportFileResults = mutableListOf>() val projects = input.ortResult.getProjects(omitExcluded = true).sortedBy { it.id } val packages = input.ortResult.getPackages(omitExcluded = true).sortedBy { it.metadata.id } val schemaVersion = Version.entries.find { - it.versionString == this.config.schemaVersion - } ?: throw IllegalArgumentException("Unsupported CycloneDX schema version '${this.config.schemaVersion}'.") + it.versionString == config.schemaVersion + } ?: throw IllegalArgumentException("Unsupported CycloneDX schema version '${config.schemaVersion}'.") - val outputFileExtensions = this.config.outputFileFormats.mapNotNullTo(mutableSetOf()) { + val outputFileExtensions = config.outputFileFormats.mapNotNullTo(mutableSetOf()) { val extension = it.trim().lowercase() extension.toFormat().alsoIfNull { logger.warn { "No CycloneDX format supports the '$extension' extension." } @@ -208,10 +203,10 @@ class CycloneDxReporter( ) } - licenses = LicenseChoice().apply { expression = Expression(this@CycloneDxReporter.config.dataLicense) } + licenses = LicenseChoice().apply { expression = Expression(config.dataLicense) } } - if (this.config.singleBom) { + if (config.singleBom) { val bom = Bom().apply { serialNumber = "urn:uuid:${UUID.randomUUID()}" this.metadata = metadata diff --git a/plugins/reporters/evaluated-model/src/main/kotlin/EvaluatedModelReporter.kt b/plugins/reporters/evaluated-model/src/main/kotlin/EvaluatedModelReporter.kt index 4ef54b45844da..64fa320aa1597 100644 --- a/plugins/reporters/evaluated-model/src/main/kotlin/EvaluatedModelReporter.kt +++ b/plugins/reporters/evaluated-model/src/main/kotlin/EvaluatedModelReporter.kt @@ -22,7 +22,6 @@ package org.ossreviewtoolkit.plugins.reporters.evaluatedmodel import java.io.File import org.ossreviewtoolkit.model.FileFormat -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.plugins.api.OrtPlugin import org.ossreviewtoolkit.plugins.api.OrtPluginOption import org.ossreviewtoolkit.plugins.api.PluginDescriptor @@ -67,14 +66,10 @@ class EvaluatedModelReporter( const val OPTION_DEDUPLICATE_DEPENDENCY_TREE = "deduplicateDependencyTree" } - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { - val evaluatedModel = EvaluatedModel.create(input, this.config.deduplicateDependencyTree) + override fun generateReport(input: ReporterInput, outputDir: File): List> { + val evaluatedModel = EvaluatedModel.create(input, config.deduplicateDependencyTree) - val outputFileFormats = this.config.outputFileFormats.map { FileFormat.forExtension(it) } + val outputFileFormats = config.outputFileFormats.map { FileFormat.forExtension(it) } return outputFileFormats.map { fileFormat -> runCatching { diff --git a/plugins/reporters/fossid/src/main/kotlin/FossIdReporter.kt b/plugins/reporters/fossid/src/main/kotlin/FossIdReporter.kt index 1797c76e58981..97a260711c2ba 100644 --- a/plugins/reporters/fossid/src/main/kotlin/FossIdReporter.kt +++ b/plugins/reporters/fossid/src/main/kotlin/FossIdReporter.kt @@ -32,7 +32,6 @@ import org.ossreviewtoolkit.clients.fossid.generateReport import org.ossreviewtoolkit.clients.fossid.model.report.ReportType import org.ossreviewtoolkit.clients.fossid.model.report.SelectionType import org.ossreviewtoolkit.model.ScanResult -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.plugins.api.OrtPlugin import org.ossreviewtoolkit.plugins.api.OrtPluginOption import org.ossreviewtoolkit.plugins.api.PluginDescriptor @@ -93,16 +92,12 @@ class FossIdReporter( const val SCAN_CODE_KEY = "scancode" } - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { - val reportType = ReportType.valueOf(this.config.reportType) - val selectionType = SelectionType.valueOf(this.config.selectionType) + override fun generateReport(input: ReporterInput, outputDir: File): List> { + val reportType = ReportType.valueOf(config.reportType) + val selectionType = SelectionType.valueOf(config.selectionType) return runBlocking(Dispatchers.IO) { - val service = FossIdRestService.create(this@FossIdReporter.config.serverUrl) + val service = FossIdRestService.create(config.serverUrl) val scanResults = input.ortResult.getScanResults().values.flatten() val scanCodes = scanResults.flatMapTo(mutableSetOf()) { it.additionalData[SCAN_CODE_KEY]?.split(',').orEmpty() @@ -113,8 +108,8 @@ class FossIdReporter( logger.info { "Generating report for scan $scanCode." } service.generateReport( - this@FossIdReporter.config.user.value, - this@FossIdReporter.config.apiKey.value, + config.user.value, + config.apiKey.value, scanCode, reportType, selectionType, diff --git a/plugins/reporters/fossid/src/main/kotlin/FossIdSnippetReporter.kt b/plugins/reporters/fossid/src/main/kotlin/FossIdSnippetReporter.kt index fea8389c14f69..9592d8841a0d2 100644 --- a/plugins/reporters/fossid/src/main/kotlin/FossIdSnippetReporter.kt +++ b/plugins/reporters/fossid/src/main/kotlin/FossIdSnippetReporter.kt @@ -21,7 +21,6 @@ package org.ossreviewtoolkit.plugins.reporters.fossid import java.io.File -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.plugins.api.OrtPlugin import org.ossreviewtoolkit.plugins.api.PluginDescriptor import org.ossreviewtoolkit.plugins.reporters.asciidoc.AsciiDocTemplateReporterConfig @@ -44,11 +43,7 @@ class FossIdSnippetReporter(override val descriptor: PluginDescriptor = FossIdSn ) } - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { + override fun generateReport(input: ReporterInput, outputDir: File): List> { val hasFossIdResults = input.ortResult.scanner?.scanResults?.any { it.scanner.name == "FossId" } == true require(hasFossIdResults) { "No FossID scan results have been found." } diff --git a/plugins/reporters/freemarker/src/main/kotlin/PlainTextTemplateReporter.kt b/plugins/reporters/freemarker/src/main/kotlin/PlainTextTemplateReporter.kt index 06aebb912a304..1274c02f60cbd 100644 --- a/plugins/reporters/freemarker/src/main/kotlin/PlainTextTemplateReporter.kt +++ b/plugins/reporters/freemarker/src/main/kotlin/PlainTextTemplateReporter.kt @@ -21,7 +21,6 @@ package org.ossreviewtoolkit.plugins.reporters.freemarker import java.io.File -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.plugins.api.OrtPlugin import org.ossreviewtoolkit.plugins.api.OrtPluginOption import org.ossreviewtoolkit.plugins.api.PluginDescriptor @@ -75,12 +74,8 @@ class PlainTextTemplateReporter( private val templateProcessor = FreemarkerTemplateProcessor(TEMPLATE_DIRECTORY) - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { - val actualConfig = this.config.takeIf { + override fun generateReport(input: ReporterInput, outputDir: File): List> { + val actualConfig = config.takeIf { it.templateIds?.isNotEmpty() == true || it.templatePaths?.isNotEmpty() == true } ?: PlainTextTemplateReporterConfig.DEFAULT diff --git a/plugins/reporters/gitlab/src/main/kotlin/GitLabLicenseModelReporter.kt b/plugins/reporters/gitlab/src/main/kotlin/GitLabLicenseModelReporter.kt index e0d4cf0d74c6a..1164c0f5f2b42 100644 --- a/plugins/reporters/gitlab/src/main/kotlin/GitLabLicenseModelReporter.kt +++ b/plugins/reporters/gitlab/src/main/kotlin/GitLabLicenseModelReporter.kt @@ -25,7 +25,6 @@ import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonNamingStrategy -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.plugins.api.OrtPlugin import org.ossreviewtoolkit.plugins.api.OrtPluginOption import org.ossreviewtoolkit.plugins.api.PluginDescriptor @@ -67,12 +66,8 @@ class GitLabLicenseModelReporter( private val reportFilename = "gl-license-scanning-report.json" - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { - val licenseModel = GitLabLicenseModelMapper.map(input.ortResult, this.config.skipExcluded) + override fun generateReport(input: ReporterInput, outputDir: File): List> { + val licenseModel = GitLabLicenseModelMapper.map(input.ortResult, config.skipExcluded) val reportFileResult = runCatching { val licenseModelJson = JSON.encodeToString(licenseModel) diff --git a/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt b/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt index 6576f77185dbb..6206c5e7aa22b 100644 --- a/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt +++ b/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt @@ -42,7 +42,6 @@ import org.ossreviewtoolkit.model.Package import org.ossreviewtoolkit.model.Project import org.ossreviewtoolkit.model.ScanResult import org.ossreviewtoolkit.model.VcsInfo -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.model.utils.getPurlType import org.ossreviewtoolkit.model.utils.toPurl import org.ossreviewtoolkit.plugins.api.OrtPlugin @@ -545,13 +544,9 @@ class OpossumReporter( return opossumInput } - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { + override fun generateReport(input: ReporterInput, outputDir: File): List> { val reportFileResult = runCatching { - val opossumInput = generateOpossumInput(input, this.config.maxDepth) + val opossumInput = generateOpossumInput(input, config.maxDepth) outputDir.resolve("report.opossum").also { writeReport(it, opossumInput) diff --git a/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentReporter.kt b/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentReporter.kt index 4e6aa7aa5581b..5db58275c17bb 100644 --- a/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentReporter.kt +++ b/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentReporter.kt @@ -23,7 +23,6 @@ import java.io.File import org.apache.logging.log4j.kotlin.logger -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.plugins.api.OrtPlugin import org.ossreviewtoolkit.plugins.api.OrtPluginOption import org.ossreviewtoolkit.plugins.api.PluginDescriptor @@ -98,21 +97,17 @@ class SpdxDocumentReporter( const val REPORT_BASE_FILENAME = "bom.spdx" } - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { - val outputFileFormats = this.config.outputFileFormats + override fun generateReport(input: ReporterInput, outputDir: File): List> { + val outputFileFormats = config.outputFileFormats .mapTo(mutableSetOf()) { FileFormat.valueOf(it.uppercase()) } val params = SpdxDocumentModelMapper.SpdxDocumentParams( - documentName = this.config.documentName, - documentComment = this.config.documentComment.orEmpty(), - creationInfoComment = this.config.creationInfoComment.orEmpty(), - creationInfoPerson = this.config.creationInfoPerson.orEmpty(), - creationInfoOrganization = this.config.creationInfoOrganization.orEmpty(), - fileInformationEnabled = this.config.fileInformationEnabled + documentName = config.documentName, + documentComment = config.documentComment.orEmpty(), + creationInfoComment = config.creationInfoComment.orEmpty(), + creationInfoPerson = config.creationInfoPerson.orEmpty(), + creationInfoOrganization = config.creationInfoOrganization.orEmpty(), + fileInformationEnabled = config.fileInformationEnabled ) val spdxDocument = SpdxDocumentModelMapper.map( diff --git a/plugins/reporters/static-html/src/main/kotlin/StaticHtmlReporter.kt b/plugins/reporters/static-html/src/main/kotlin/StaticHtmlReporter.kt index 4df71cd3d5d40..d6ad7bf22aa21 100644 --- a/plugins/reporters/static-html/src/main/kotlin/StaticHtmlReporter.kt +++ b/plugins/reporters/static-html/src/main/kotlin/StaticHtmlReporter.kt @@ -41,7 +41,6 @@ import org.ossreviewtoolkit.model.RepositoryProvenance import org.ossreviewtoolkit.model.Severity import org.ossreviewtoolkit.model.VcsInfo import org.ossreviewtoolkit.model.config.PathExclude -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.model.config.RepositoryConfiguration import org.ossreviewtoolkit.model.config.ScopeExclude import org.ossreviewtoolkit.model.licenses.ResolvedLicenseLocation @@ -77,11 +76,7 @@ class StaticHtmlReporter(override val descriptor: PluginDescriptor = StaticHtmlR private val css = javaClass.getResource("/static-html-reporter.css").readText() private val licensesSha1 = mutableMapOf() - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { + override fun generateReport(input: ReporterInput, outputDir: File): List> { val tablesReport = TablesReportModelMapper.map(input) val reportFileResult = runCatching { diff --git a/plugins/reporters/trustsource/src/main/kotlin/TrustSourceReporter.kt b/plugins/reporters/trustsource/src/main/kotlin/TrustSourceReporter.kt index dc275b8b732f1..0034b7f095a5f 100644 --- a/plugins/reporters/trustsource/src/main/kotlin/TrustSourceReporter.kt +++ b/plugins/reporters/trustsource/src/main/kotlin/TrustSourceReporter.kt @@ -25,7 +25,6 @@ import kotlinx.serialization.json.Json import kotlinx.serialization.json.encodeToStream import org.ossreviewtoolkit.model.DependencyNode -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.model.licenses.LicenseView import org.ossreviewtoolkit.plugins.api.OrtPlugin import org.ossreviewtoolkit.plugins.api.PluginDescriptor @@ -46,11 +45,7 @@ class TrustSourceReporter(override val descriptor: PluginDescriptor = TrustSourc private val reportFilename = "trustsource-report.json" - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { + override fun generateReport(input: ReporterInput, outputDir: File): List> { val outputFile = outputDir.resolve(reportFilename) val nav = input.ortResult.dependencyNavigator diff --git a/plugins/reporters/web-app/src/main/kotlin/WebAppReporter.kt b/plugins/reporters/web-app/src/main/kotlin/WebAppReporter.kt index 49f7ea27de32c..a148e49a9fa85 100644 --- a/plugins/reporters/web-app/src/main/kotlin/WebAppReporter.kt +++ b/plugins/reporters/web-app/src/main/kotlin/WebAppReporter.kt @@ -29,7 +29,6 @@ import kotlin.io.encoding.encodingWith import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream import org.apache.commons.compress.compressors.gzip.GzipParameters -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.plugins.api.OrtPlugin import org.ossreviewtoolkit.plugins.api.OrtPluginOption import org.ossreviewtoolkit.plugins.api.PluginDescriptor @@ -62,13 +61,9 @@ class WebAppReporter( ) : Reporter { private val reportFilename = "scan-report-web-app.html" - override fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration - ): List> { + override fun generateReport(input: ReporterInput, outputDir: File): List> { val template = javaClass.getResource("/scan-report-template.html").readText() - val evaluatedModel = EvaluatedModel.create(input, this.config.deduplicateDependencyTree) + val evaluatedModel = EvaluatedModel.create(input, config.deduplicateDependencyTree) val index = template.indexOf(PLACEHOLDER) val prefix = template.substring(0, index) diff --git a/reporter/src/main/kotlin/Reporter.kt b/reporter/src/main/kotlin/Reporter.kt index 77e451b74ed15..8b109d584fb9f 100644 --- a/reporter/src/main/kotlin/Reporter.kt +++ b/reporter/src/main/kotlin/Reporter.kt @@ -22,7 +22,6 @@ package org.ossreviewtoolkit.reporter import java.io.File import org.ossreviewtoolkit.model.OrtResult -import org.ossreviewtoolkit.model.config.PluginConfiguration import org.ossreviewtoolkit.plugins.api.Plugin /** @@ -31,13 +30,9 @@ import org.ossreviewtoolkit.plugins.api.Plugin interface Reporter : Plugin { /** * Generate a report for the provided [input] and write the generated file(s) to the [outputDir]. If and how the - * [input] data is used depends on the specific reporter implementation, taking into account any format-specific - * [config]. Return a list of [Result]s that wrap the generated report file on success, or a file specific failure - * if something went wrong. + * [input] data is used depends on the specific reporter implementation. + * Return a list of [Result]s that wrap the generated report file on success, or a file specific failure if + * something went wrong. */ - fun generateReport( - input: ReporterInput, - outputDir: File, - config: PluginConfiguration = PluginConfiguration.EMPTY - ): List> + fun generateReport(input: ReporterInput, outputDir: File): List> }