diff --git a/.detekt.yml b/.detekt.yml index f6b9c3139dd0..7f2f52c57510 100644 --- a/.detekt.yml +++ b/.detekt.yml @@ -38,8 +38,6 @@ formatting: functionBodyExpressionWrapping: multiline ImportOrdering: active: false - Indentation: - active: false MaximumLineLength: active: false NoUnusedImports: diff --git a/.editorconfig b/.editorconfig index 0a5adb2edcdb..48d697fb03a9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ [*.{kt,kts}] indent_size=4 -continuation_indent_size=8 +continuation_indent_size=4 insert_final_newline=true max_line_length=120 diff --git a/advisor/src/main/kotlin/Advisor.kt b/advisor/src/main/kotlin/Advisor.kt index ef695401a9f9..adad9cc97690 100644 --- a/advisor/src/main/kotlin/Advisor.kt +++ b/advisor/src/main/kotlin/Advisor.kt @@ -60,7 +60,7 @@ class Advisor( if (ortResult.analyzer == null) { logger.warn { "Cannot run the advisor as the provided ORT result does not contain an analyzer result. " + - "No result will be added." + "No result will be added." } return ortResult @@ -91,7 +91,7 @@ class Advisor( logger.info { "Found ${providerResults.values.flatMap { it.vulnerabilities }.distinct().size} distinct " + - "vulnerabilities via ${provider.providerName}. " + "vulnerabilities via ${provider.providerName}. " } providerResults.keys.takeIf { it.isNotEmpty() }?.let { pkgs -> diff --git a/advisor/src/main/kotlin/advisors/GitHubDefects.kt b/advisor/src/main/kotlin/advisors/GitHubDefects.kt index a92426927a2d..cc1536ab6e02 100644 --- a/advisor/src/main/kotlin/advisors/GitHubDefects.kt +++ b/advisor/src/main/kotlin/advisors/GitHubDefects.kt @@ -167,7 +167,7 @@ class GitHubDefects(name: String, config: GitHubDefectsConfiguration) : AdvicePr ortIssues += createAndLogIssue( providerName, "Failed to load information about $itemType for package '${pkg.original.id.toCoordinates()}': " + - exception.collectMessages(), + exception.collectMessages(), Severity.ERROR ) }.getOrNull().orEmpty() @@ -231,9 +231,9 @@ class GitHubDefects(name: String, config: GitHubDefectsConfiguration) : AdvicePr */ private fun List.applyLabelFilters(): List = filter { issue -> - val labels = issue.labels() - labelFilters.find { it.matches(labels) }?.including ?: false - } + val labels = issue.labels() + labelFilters.find { it.matches(labels) }?.including ?: false + } } /** diff --git a/advisor/src/main/kotlin/advisors/VulnerableCode.kt b/advisor/src/main/kotlin/advisors/VulnerableCode.kt index 9265eab161cb..bfe9f8f43d6f 100644 --- a/advisor/src/main/kotlin/advisors/VulnerableCode.kt +++ b/advisor/src/main/kotlin/advisors/VulnerableCode.kt @@ -127,18 +127,18 @@ class VulnerableCode(name: String, config: VulnerableCodeConfiguration) : Advice issues: MutableList ): List = runCatching { - val sourceUri = URI(url) - if (scores.isEmpty()) return listOf(VulnerabilityReference(sourceUri, null, null)) - return scores.map { - // VulnerableCode returns MODERATE instead of MEDIUM in case of cvssv3.1_qr, see: - // https://github.com/nexB/vulnerablecode/issues/1186 - val severity = if (it.scoringSystem == "cvssv3.1_qr" && it.value == "MODERATE") "MEDIUM" else it.value - - VulnerabilityReference(sourceUri, it.scoringSystem, severity) - } - }.onFailure { - issues += createAndLogIssue(providerName, "Failed to map $this to ORT model due to $it.", Severity.HINT) - }.getOrElse { emptyList() } + val sourceUri = URI(url) + if (scores.isEmpty()) return listOf(VulnerabilityReference(sourceUri, null, null)) + return scores.map { + // VulnerableCode returns MODERATE instead of MEDIUM in case of cvssv3.1_qr, see: + // https://github.com/nexB/vulnerablecode/issues/1186 + val severity = if (it.scoringSystem == "cvssv3.1_qr" && it.value == "MODERATE") "MEDIUM" else it.value + + VulnerabilityReference(sourceUri, it.scoringSystem, severity) + } + }.onFailure { + issues += createAndLogIssue(providerName, "Failed to map $this to ORT model due to $it.", Severity.HINT) + }.getOrElse { emptyList() } /** * Return a meaningful identifier for this vulnerability that can be used in reports. Obtain this identifier from diff --git a/analyzer/src/funTest/kotlin/PackageManagerFunTest.kt b/analyzer/src/funTest/kotlin/PackageManagerFunTest.kt index 03e80179faaf..62c7e9e6cc83 100644 --- a/analyzer/src/funTest/kotlin/PackageManagerFunTest.kt +++ b/analyzer/src/funTest/kotlin/PackageManagerFunTest.kt @@ -174,7 +174,7 @@ class PackageManagerFunTest : WordSpec({ "take path excludes into account" { val tempDir = "test/" val definitionFilesWithExcludes = definitionFiles + - listOf("pom.xml", "build.gradle", "build.sbt").map { "$tempDir$it" } + listOf("pom.xml", "build.gradle", "build.sbt").map { "$tempDir$it" } val rootDir = tempdir() definitionFilesWithExcludes.writeFiles(rootDir) diff --git a/analyzer/src/funTest/kotlin/managers/GoDepFunTest.kt b/analyzer/src/funTest/kotlin/managers/GoDepFunTest.kt index b0df3d553afe..4abecb3e3694 100644 --- a/analyzer/src/funTest/kotlin/managers/GoDepFunTest.kt +++ b/analyzer/src/funTest/kotlin/managers/GoDepFunTest.kt @@ -53,9 +53,9 @@ class GoDepFunTest : WordSpec({ with(result) { project.id shouldBe - Identifier("GoDep::src/funTest/assets/projects/synthetic/godep/no-lockfile/Gopkg.toml:") + Identifier("GoDep::src/funTest/assets/projects/synthetic/godep/no-lockfile/Gopkg.toml:") project.definitionFilePath shouldBe - "analyzer/src/funTest/assets/projects/synthetic/godep/no-lockfile/Gopkg.toml" + "analyzer/src/funTest/assets/projects/synthetic/godep/no-lockfile/Gopkg.toml" packages should beEmpty() issues.size shouldBe 1 issues.first().message should haveSubstring("IllegalArgumentException: No lockfile found in") @@ -102,7 +102,7 @@ class GoDepFunTest : WordSpec({ val vcsInfo = VcsInfo.EMPTY.copy(url = "https://github.com/oss-review-toolkit/ort.git") deduceImportPath(projectDir, vcsInfo, gopath) shouldBe - gopath.resolve("src/github.com/oss-review-toolkit/ort.git") + gopath.resolve("src/github.com/oss-review-toolkit/ort.git") } "deduce an import path without VCS info" { diff --git a/analyzer/src/main/kotlin/Analyzer.kt b/analyzer/src/main/kotlin/Analyzer.kt index 48848bab6477..6e815caeeb53 100644 --- a/analyzer/src/main/kotlin/Analyzer.kt +++ b/analyzer/src/main/kotlin/Analyzer.kt @@ -207,7 +207,7 @@ class Analyzer(private val config: AnalyzerConfiguration, private val labels: Ma if (managerForName == null) { logger.debug { "Ignoring that ${packageManager.managerName} must run after $name, because there are no " + - "definition files for $name." + "definition files for $name." } } else { result.getOrPut(packageManager) { mutableSetOf() } += name @@ -223,7 +223,7 @@ class Analyzer(private val config: AnalyzerConfiguration, private val labels: Ma if (managerForName == null) { logger.debug { "Ignoring that ${packageManager.managerName} must run before $name, because there are no " + - "definition files for $name." + "definition files for $name." } } else { result.getOrPut(managerForName) { mutableSetOf() } += packageManager.managerName @@ -305,7 +305,7 @@ private class PackageManagerRunner( if (remaining.isNotEmpty()) { Analyzer.logger.info { "${manager.managerName} is waiting for the following package managers to complete: " + - remaining.joinToString(postfix = ".") + remaining.joinToString(postfix = ".") } } diff --git a/analyzer/src/main/kotlin/AnalyzerResultBuilder.kt b/analyzer/src/main/kotlin/AnalyzerResultBuilder.kt index 8e393fb336bf..d9e5c85bd75c 100644 --- a/analyzer/src/main/kotlin/AnalyzerResultBuilder.kt +++ b/analyzer/src/main/kotlin/AnalyzerResultBuilder.kt @@ -48,7 +48,7 @@ class AnalyzerResultBuilder { val duplicates = (projects.map { it.toPackage() } + packages).getDuplicates { it.id } require(duplicates.isEmpty()) { "Unable to create the AnalyzerResult as it contains packages and projects with the same ids: " + - duplicates.values + duplicates.values } return AnalyzerResult(projects, packages, issues, dependencyGraphs) @@ -58,37 +58,37 @@ class AnalyzerResultBuilder { fun addResult(projectAnalyzerResult: ProjectAnalyzerResult) = apply { - // TODO: It might be, e.g. in the case of PIP "requirements.txt" projects, that different projects with - // the same ID exist. We need to decide how to handle that case. - val existingProject = projects.find { it.id == projectAnalyzerResult.project.id } + // TODO: It might be, e.g. in the case of PIP "requirements.txt" projects, that different projects with + // the same ID exist. We need to decide how to handle that case. + val existingProject = projects.find { it.id == projectAnalyzerResult.project.id } - if (existingProject != null) { - val existingDefinitionFileUrl = existingProject.let { - "${it.vcsProcessed.url}/${it.definitionFilePath}" - } - val incomingDefinitionFileUrl = projectAnalyzerResult.project.let { - "${it.vcsProcessed.url}/${it.definitionFilePath}" - } + if (existingProject != null) { + val existingDefinitionFileUrl = existingProject.let { + "${it.vcsProcessed.url}/${it.definitionFilePath}" + } + val incomingDefinitionFileUrl = projectAnalyzerResult.project.let { + "${it.vcsProcessed.url}/${it.definitionFilePath}" + } - val issue = createAndLogIssue( - source = "analyzer", - message = "Multiple projects with the same id '${existingProject.id.toCoordinates()}' " + + val issue = createAndLogIssue( + source = "analyzer", + message = "Multiple projects with the same id '${existingProject.id.toCoordinates()}' " + "found. Not adding the project defined in '$incomingDefinitionFileUrl' to the " + "analyzer results as it duplicates the project defined in " + "'$existingDefinitionFileUrl'." - ) + ) - val projectIssues = issues.getOrDefault(existingProject.id, emptyList()) - issues[existingProject.id] = projectIssues + issue - } else { - projects += projectAnalyzerResult.project - addPackages(projectAnalyzerResult.packages) + val projectIssues = issues.getOrDefault(existingProject.id, emptyList()) + issues[existingProject.id] = projectIssues + issue + } else { + projects += projectAnalyzerResult.project + addPackages(projectAnalyzerResult.packages) - if (projectAnalyzerResult.issues.isNotEmpty()) { - issues[projectAnalyzerResult.project.id] = projectAnalyzerResult.issues + if (projectAnalyzerResult.issues.isNotEmpty()) { + issues[projectAnalyzerResult.project.id] = projectAnalyzerResult.issues + } } } - } /** * Add the given [packageSet] to this builder. This function can be used for packages that have been obtained @@ -102,8 +102,8 @@ class AnalyzerResultBuilder { */ fun addDependencyGraph(packageManagerName: String, graph: DependencyGraph) = apply { - dependencyGraphs[packageManagerName] = graph - } + dependencyGraphs[packageManagerName] = graph + } } private fun AnalyzerResult.resolvePackageManagerDependencies(): AnalyzerResult { diff --git a/analyzer/src/main/kotlin/PackageManager.kt b/analyzer/src/main/kotlin/PackageManager.kt index d58756f46403..70d87a126ac0 100644 --- a/analyzer/src/main/kotlin/PackageManager.kt +++ b/analyzer/src/main/kotlin/PackageManager.kt @@ -339,7 +339,7 @@ abstract class PackageManager( createAndLogIssue( source = managerName, message = "$managerName failed to resolve dependencies for path '$relativePath': " + - it.collectMessages() + it.collectMessages() ) ) @@ -369,7 +369,7 @@ abstract class PackageManager( .takeUnless { it.isEmpty() } ?: "." "No lockfile found in '$relativePathString'. This potentially results in unstable versions of " + - "dependencies. To support this, enable the 'allowDynamicVersions' option in '$ORT_CONFIG_FILENAME'." + "dependencies. To support this, enable the 'allowDynamicVersions' option in '$ORT_CONFIG_FILENAME'." } } diff --git a/analyzer/src/main/kotlin/managers/Sbt.kt b/analyzer/src/main/kotlin/managers/Sbt.kt index 8f450c2678d7..4a323d5f7858 100644 --- a/analyzer/src/main/kotlin/managers/Sbt.kt +++ b/analyzer/src/main/kotlin/managers/Sbt.kt @@ -173,7 +173,7 @@ class Sbt( logger.info { "No POM locations found in the output of SBT's 'makePom' command. Falling back to look for POMs in " + - "the '$targetDir' directory." + "the '$targetDir' directory." } targetDir.walk().maxDepth(1).filterTo(pomFiles) { it.extension == "pom" } @@ -215,7 +215,7 @@ class Sbt( if (!Semver(lowestSbtVersion).satisfies(sbtVersionRequirement)) { throw IOException( "Unsupported $managerName version $lowestSbtVersion does not fulfill " + - "$sbtVersionRequirement." + "$sbtVersionRequirement." ) } } diff --git a/analyzer/src/main/kotlin/managers/utils/MavenDependencyHandler.kt b/analyzer/src/main/kotlin/managers/utils/MavenDependencyHandler.kt index 982e13f24d94..198d7e67df8a 100644 --- a/analyzer/src/main/kotlin/managers/utils/MavenDependencyHandler.kt +++ b/analyzer/src/main/kotlin/managers/utils/MavenDependencyHandler.kt @@ -112,7 +112,7 @@ class MavenDependencyHandler( issues += createAndLogIssue( source = managerName, message = "Could not get package information for dependency '" + - "${dependency.artifact.identifier()}': ${e.collectMessages()}" + "${dependency.artifact.identifier()}': ${e.collectMessages()}" ) }.getOrNull() } diff --git a/analyzer/src/main/kotlin/managers/utils/MavenSupport.kt b/analyzer/src/main/kotlin/managers/utils/MavenSupport.kt index 305a335468c6..4f070c406678 100644 --- a/analyzer/src/main/kotlin/managers/utils/MavenSupport.kt +++ b/analyzer/src/main/kotlin/managers/utils/MavenSupport.kt @@ -229,14 +229,14 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) { // clear cases. logger.info { "Maven SCM connection '$connection' of project ${project.artifact} lacks the required " + - "'scm' prefix." + "'scm' prefix." } VcsInfo(type = VcsType.GIT, url = connection, revision = tag) } else { logger.info { "Ignoring Maven SCM connection '$connection' of project ${project.artifact} due to an " + - "unexpected format." + "unexpected format." } VcsInfo.EMPTY @@ -427,7 +427,7 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) { logger.warn { "There have been issues building the Maven project models, this could lead to errors during " + - "dependency analysis: ${e.collectMessages()}" + "dependency analysis: ${e.collectMessages()}" } e.results @@ -439,7 +439,7 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) { if (projectBuildingResult.project == null) { logger.warn { "Project for POM file '${projectBuildingResult.pomFile.absolutePath}' could not be built:\n" + - projectBuildingResult.problems.joinToString("\n") + projectBuildingResult.problems.joinToString("\n") } } else { val project = projectBuildingResult.project @@ -470,8 +470,8 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) { if (resultForPomFile != null) { logger.warn { "There was an error building project '${e.projectId}' at '${e.pomFile.safePath}'. " + - "Still continuing with the incompletely built project '${resultForPomFile.projectId}' at " + - "'${resultForPomFile.pomFile.safePath}': ${e.collectMessages()}" + "Still continuing with the incompletely built project '${resultForPomFile.projectId}' at " + + "'${resultForPomFile.pomFile.safePath}': ${e.collectMessages()}" } resultForPomFile @@ -704,7 +704,7 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) { if (failedProject != null) { logger.warn { "There was an error building '${it.identifier()}', continuing with the incompletely built " + - "project: ${e.collectMessages()}" + "project: ${e.collectMessages()}" } failedProject.project } else { @@ -759,9 +759,9 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) { val isSpringMetadataProject = with(mavenProject) { listOf("boot", "cloud").any { groupId == "org.springframework.$it" && ( - artifactId.startsWith("spring-$it-starter") || + artifactId.startsWith("spring-$it-starter") || artifactId.startsWith("spring-$it-contract-spec") - ) + ) } } @@ -782,7 +782,7 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) { vcs = vcsFromPackage, vcsProcessed = vcsProcessed, isMetadataOnly = (mavenProject.packaging == "pom" && binaryRemoteArtifact.url.endsWith(".pom")) - || isSpringMetadataProject, + || isSpringMetadataProject, isModified = isBinaryArtifactModified || isSourceArtifactModified ) } diff --git a/analyzer/src/main/kotlin/managers/utils/PackageManagerDependencyHandler.kt b/analyzer/src/main/kotlin/managers/utils/PackageManagerDependencyHandler.kt index b1e2fac63ca5..557cdf6fe576 100644 --- a/analyzer/src/main/kotlin/managers/utils/PackageManagerDependencyHandler.kt +++ b/analyzer/src/main/kotlin/managers/utils/PackageManagerDependencyHandler.kt @@ -136,18 +136,18 @@ private data class PackageManagerDependency( require(project.id.type == packageManager) { "The project '${project.id.toCoordinates()}' from definition file '$definitionFile' uses the wrong " + - "package manager '${project.id.type}', expected is '$packageManager'." + "package manager '${project.id.type}', expected is '$packageManager'." } requireNotNull(project.scopeNames) { "The project '${project.id.toCoordinates()}' from definition file '$definitionFile' does not use a " + - "dependency graph." + "dependency graph." } if (scope !in project.scopeNames.orEmpty()) { logger.warn { "The project '${project.id.toCoordinates()}' from definition file '$definitionFile' does not contain " + - "the requested scope '$scope'." + "the requested scope '$scope'." } } } diff --git a/analyzer/src/test/kotlin/managers/utils/MavenSupportTest.kt b/analyzer/src/test/kotlin/managers/utils/MavenSupportTest.kt index 4cd76ea2f1c1..ba4879b2d971 100644 --- a/analyzer/src/test/kotlin/managers/utils/MavenSupportTest.kt +++ b/analyzer/src/test/kotlin/managers/utils/MavenSupportTest.kt @@ -46,7 +46,7 @@ class MavenSupportTest : WordSpec({ } MavenSupport.getOriginalScm(mavenProject)?.connection shouldBe - "scm:git:https://github.com/spring-projects/spring-boot.git" + "scm:git:https://github.com/spring-projects/spring-boot.git" MavenSupport.getOriginalScm(mavenProject)?.url shouldBe "https://github.com/oss-review-toolkit/correctUrl" } @@ -65,7 +65,7 @@ class MavenSupportTest : WordSpec({ } MavenSupport.getOriginalScm(mavenProject)?.connection shouldBe - "scm:git:https://github.com/oss-review-toolkit/childConnection.git" + "scm:git:https://github.com/oss-review-toolkit/childConnection.git" MavenSupport.getOriginalScm(mavenProject)?.url shouldBe "https://github.com/spring-projects/spring-boot" } } diff --git a/cli/src/main/kotlin/OrtMain.kt b/cli/src/main/kotlin/OrtMain.kt index 20814a8cff8c..bd7e72cbb105 100644 --- a/cli/src/main/kotlin/OrtMain.kt +++ b/cli/src/main/kotlin/OrtMain.kt @@ -109,7 +109,7 @@ class OrtMain : CliktCommand( private val configArguments by option( "-P", help = "Override a key-value pair in the configuration file. For example: " + - "-P ort.scanner.storages.postgres.connection.schema=testSchema" + "-P ort.scanner.storages.postgres.connection.schema=testSchema" ).associate() private val helpAll by option( diff --git a/clients/fossid-webapp/src/main/kotlin/Extensions.kt b/clients/fossid-webapp/src/main/kotlin/Extensions.kt index b718ad9b07cf..37e8f91ebf1f 100644 --- a/clients/fossid-webapp/src/main/kotlin/Extensions.kt +++ b/clients/fossid-webapp/src/main/kotlin/Extensions.kt @@ -121,18 +121,18 @@ suspend fun FossIdRestService.createProject( projectName: String, comment: String = "Created by ORT" ) = createProject( - PostRequestBody( - "create", - PROJECT_GROUP, - user, - apiKey, - mapOf( - "project_code" to projectCode, - "project_name" to projectName, - "comment" to comment - ) + PostRequestBody( + "create", + PROJECT_GROUP, + user, + apiKey, + mapOf( + "project_code" to projectCode, + "project_name" to projectName, + "comment" to comment ) ) +) /** * Create a new scan of [gitRepoUrl]/[gitBranch] for the given [projectCode]. @@ -205,7 +205,7 @@ suspend fun FossIdRestService.deleteScan(user: String, apiKey: String, scanCode: "scan_code" to scanCode, "delete_identifications" to "1" ) - ) + ) ) /** @@ -371,19 +371,19 @@ suspend fun FossIdRestService.createIgnoreRule( value: String, scope: RuleScope ) = createIgnoreRule( - PostRequestBody( - "ignore_rules_add", - SCAN_GROUP, - user, - apiKey, - mapOf( - "scan_code" to scanCode, - "type" to type.name.lowercase(), - "value" to value, - "apply_to" to scope.name.lowercase() - ) + PostRequestBody( + "ignore_rules_add", + SCAN_GROUP, + user, + apiKey, + mapOf( + "scan_code" to scanCode, + "type" to type.name.lowercase(), + "value" to value, + "apply_to" to scope.name.lowercase() ) ) +) /** * Ask the FossID server to generate a [reportType] report containing [selectionType]. The report will be generated in diff --git a/clients/fossid-webapp/src/main/kotlin/FossIdServiceWithVersion.kt b/clients/fossid-webapp/src/main/kotlin/FossIdServiceWithVersion.kt index 8603852f99b1..d968ea59231d 100644 --- a/clients/fossid-webapp/src/main/kotlin/FossIdServiceWithVersion.kt +++ b/clients/fossid-webapp/src/main/kotlin/FossIdServiceWithVersion.kt @@ -31,13 +31,13 @@ abstract class FossIdServiceWithVersion(val version: String) : FossIdRestService */ fun instance(delegate: FossIdRestService): FossIdServiceWithVersion = runBlocking { - val version = delegate.getFossIdVersion().orEmpty() + val version = delegate.getFossIdVersion().orEmpty() - when { - version >= "2021.2" -> VersionedFossIdService2021dot2(delegate, version) - else -> VersionedFossIdService(delegate, version) + when { + version >= "2021.2" -> VersionedFossIdService2021dot2(delegate, version) + else -> VersionedFossIdService(delegate, version) + } } - } } /** diff --git a/clients/fossid-webapp/src/main/kotlin/VersionedFossIdService.kt b/clients/fossid-webapp/src/main/kotlin/VersionedFossIdService.kt index 64b749d9697a..6377386603a2 100644 --- a/clients/fossid-webapp/src/main/kotlin/VersionedFossIdService.kt +++ b/clients/fossid-webapp/src/main/kotlin/VersionedFossIdService.kt @@ -34,6 +34,6 @@ open class VersionedFossIdService( scanCode: String ): EntityResponseBody = delegate.checkScanStatus( - PostRequestBody("check_status", SCAN_GROUP, user, apiKey, mapOf("scan_code" to scanCode)) - ) + PostRequestBody("check_status", SCAN_GROUP, user, apiKey, mapOf("scan_code" to scanCode)) + ) } diff --git a/clients/fossid-webapp/src/main/kotlin/model/identification/ignored/IgnoredFile.kt b/clients/fossid-webapp/src/main/kotlin/model/identification/ignored/IgnoredFile.kt index b609c4a7bbe2..ed617e5b4657 100644 --- a/clients/fossid-webapp/src/main/kotlin/model/identification/ignored/IgnoredFile.kt +++ b/clients/fossid-webapp/src/main/kotlin/model/identification/ignored/IgnoredFile.kt @@ -22,10 +22,10 @@ package org.ossreviewtoolkit.clients.fossid.model.identification.ignored import com.fasterxml.jackson.annotation.JsonProperty data class IgnoredFile( - @JsonProperty("scan_file_id") - val id: Int, - @JsonProperty("local_path") - val path: String, - val reason: String, - val matchType: String + @JsonProperty("scan_file_id") + val id: Int, + @JsonProperty("local_path") + val path: String, + val reason: String, + val matchType: String ) diff --git a/clients/fossid-webapp/src/test/kotlin/FossIdReportTest.kt b/clients/fossid-webapp/src/test/kotlin/FossIdReportTest.kt index c6c6df8840c4..e63867c47b79 100644 --- a/clients/fossid-webapp/src/test/kotlin/FossIdReportTest.kt +++ b/clients/fossid-webapp/src/test/kotlin/FossIdReportTest.kt @@ -68,8 +68,8 @@ class FossIdReportTest : StringSpec({ ) result.shouldBeSuccess { it shouldHaveName "fossid-" + - "semver4j_semver4j__20220119_094101_delta-" + - "cc1267688905d7493df292786a245297c9fd36ee.html" + "semver4j_semver4j__20220119_094101_delta-" + + "cc1267688905d7493df292786a245297c9fd36ee.html" it.useLines { lines -> lines shouldContain "" } diff --git a/clients/github-graphql/src/main/kotlin/GitHubService.kt b/clients/github-graphql/src/main/kotlin/GitHubService.kt index ba2e0cdd69b7..aa6ad5f846a4 100644 --- a/clients/github-graphql/src/main/kotlin/GitHubService.kt +++ b/clients/github-graphql/src/main/kotlin/GitHubService.kt @@ -113,14 +113,14 @@ class GitHubService private constructor( paging: Paging = Paging.INITIAL ): QueryResult = runCatching { - val query = ReleasesQuery(ReleasesQuery.Variables(owner, repository, paging.pageSize, paging.cursor)) - val result = client.executeAndCheck(query) + val query = ReleasesQuery(ReleasesQuery.Variables(owner, repository, paging.pageSize, paging.cursor)) + val result = client.executeAndCheck(query) - val releasesConnection = result.data?.repository?.releases - val pageInfo = releasesConnection?.pageInfo - val nextCursor = pageInfo?.endCursor?.takeIf { pageInfo.hasNextPage } - PagedResult(releasesConnection?.edges.orEmpty().mapNotNull { it?.node }, paging.pageSize, nextCursor) - } + val releasesConnection = result.data?.repository?.releases + val pageInfo = releasesConnection?.pageInfo + val nextCursor = pageInfo?.endCursor?.takeIf { pageInfo.hasNextPage } + PagedResult(releasesConnection?.edges.orEmpty().mapNotNull { it?.node }, paging.pageSize, nextCursor) + } } /** diff --git a/clients/github-graphql/src/test/kotlin/GitHubServiceTest.kt b/clients/github-graphql/src/test/kotlin/GitHubServiceTest.kt index 92d64d05f68b..7791afd03dc0 100644 --- a/clients/github-graphql/src/test/kotlin/GitHubServiceTest.kt +++ b/clients/github-graphql/src/test/kotlin/GitHubServiceTest.kt @@ -116,7 +116,7 @@ class GitHubServiceTest : WordSpec({ exception.errors shouldHaveSize 1 with(exception.errors.first()) { message shouldBe - "Requesting 101 records on the `issues` connection exceeds the `first` limit of 100 records." + "Requesting 101 records on the `issues` connection exceeds the `first` limit of 100 records." path should containExactly("repository", "issues") } } diff --git a/clients/osv/src/funTest/kotlin/OsvServiceFunTest.kt b/clients/osv/src/funTest/kotlin/OsvServiceFunTest.kt index 7772e6a60c2e..a7913110af1a 100644 --- a/clients/osv/src/funTest/kotlin/OsvServiceFunTest.kt +++ b/clients/osv/src/funTest/kotlin/OsvServiceFunTest.kt @@ -49,12 +49,12 @@ private val VULNERABILITY_FOR_PACKAGE_BY_INVALID_COMMIT_REQUEST = Vulnerabilitie private fun Vulnerability.patchIgnorableFields() = copy( - modified = Instant.EPOCH, - databaseSpecific = emptyJsonObject.takeIf { databaseSpecific != null }, - affected = affected.mapTo(mutableSetOf()) { affected -> - affected.copy(ecosystemSpecific = emptyJsonObject.takeIf { affected.ecosystemSpecific != null }) - } -) + modified = Instant.EPOCH, + databaseSpecific = emptyJsonObject.takeIf { databaseSpecific != null }, + affected = affected.mapTo(mutableSetOf()) { affected -> + affected.copy(ecosystemSpecific = emptyJsonObject.takeIf { affected.ecosystemSpecific != null }) + } + ) private val emptyJsonObject = JsonObject(emptyMap()) diff --git a/detekt-rules/build.gradle.kts b/detekt-rules/build.gradle.kts index 2dc00e76e3be..52f54afbda18 100644 --- a/detekt-rules/build.gradle.kts +++ b/detekt-rules/build.gradle.kts @@ -53,7 +53,7 @@ tasks.named("jar") { doLast { val out = objects.newInstance().out.create("detekt-rules") val message = "The detekt-rules have changed. You need to stop the Gradle daemon to allow the detekt plugin " + - "to reload for the rule changes to take effect." + "to reload for the rule changes to take effect." out.withStyle(StyledTextOutput.Style.Info).println(message) } } diff --git a/detekt-rules/src/main/kotlin/OrtImportOrder.kt b/detekt-rules/src/main/kotlin/OrtImportOrder.kt index 0c22157a55d5..674ec69278af 100644 --- a/detekt-rules/src/main/kotlin/OrtImportOrder.kt +++ b/detekt-rules/src/main/kotlin/OrtImportOrder.kt @@ -68,7 +68,7 @@ class OrtImportOrder(config: Config) : Rule(config) { if (importPaths != expectedImportOrder) { val path = importList.containingKtFile.absolutePath() val message = "Imports in file '$path' are not sorted alphabetically or single blank lines are missing " + - "between different top-level packages" + "between different top-level packages" val finding = CodeSmell( issue, // Use the message as the name to also see it in CLI output and not only in the report files. diff --git a/downloader/src/funTest/kotlin/DownloaderFunTest.kt b/downloader/src/funTest/kotlin/DownloaderFunTest.kt index 2e94995d5a99..3f0cb245240f 100644 --- a/downloader/src/funTest/kotlin/DownloaderFunTest.kt +++ b/downloader/src/funTest/kotlin/DownloaderFunTest.kt @@ -179,10 +179,10 @@ class DownloaderFunTest : WordSpec({ exception.suppressed.size shouldBe 2 exception.suppressed[0]!!.message shouldBe "No VCS URL provided for 'Maven:junit:junit:4.12'. " + - "Please define the \"connection\" tag within the \"scm\" tag in the POM file, " + - "see: https://maven.apache.org/pom.html#SCM" + "Please define the \"connection\" tag within the \"scm\" tag in the POM file, " + + "see: https://maven.apache.org/pom.html#SCM" exception.suppressed[1]!!.message shouldBe "Source artifact does not match expected " + - "Hash(value=0123456789abcdef0123456789abcdef01234567, algorithm=SHA-1)." + "Hash(value=0123456789abcdef0123456789abcdef01234567, algorithm=SHA-1)." } "should be tried as a fallback when the download from VCS fails" { diff --git a/downloader/src/main/kotlin/Downloader.kt b/downloader/src/main/kotlin/Downloader.kt index 5f8e00203a15..310e093b3cc3 100644 --- a/downloader/src/main/kotlin/Downloader.kt +++ b/downloader/src/main/kotlin/Downloader.kt @@ -122,7 +122,7 @@ class Downloader(private val config: DownloaderConfiguration) { logger.info { "Failed attempt to download source code for '${pkg.id.toCoordinates()}' from ${pkg.vcsProcessed} " + - "took ${vcsMark.elapsedNow()}." + "took ${vcsMark.elapsedNow()}." } // Clean up any left-over files (force to delete read-only files in ".git" directories on Windows). @@ -151,7 +151,7 @@ class Downloader(private val config: DownloaderConfiguration) { logger.info { "Downloaded source code for '${pkg.id.toCoordinates()}' from ${pkg.sourceArtifact} in " + - "${sourceArtifactMark.elapsedNow()}." + "${sourceArtifactMark.elapsedNow()}." } return result @@ -162,7 +162,7 @@ class Downloader(private val config: DownloaderConfiguration) { logger.info { "Failed attempt to download source code for '${pkg.id.toCoordinates()}' from ${pkg.sourceArtifact} " + - "took ${sourceArtifactMark.elapsedNow()}." + "took ${sourceArtifactMark.elapsedNow()}." } // Clean up any left-over files. @@ -191,23 +191,23 @@ class Downloader(private val config: DownloaderConfiguration) { val hint = when (pkg.id.type) { "Bundler", "Gem" -> " Please define the \"source_code_uri\" in the \"metadata\" of the Gemspec, see: " + - "https://guides.rubygems.org/specification-reference/#metadata" + "https://guides.rubygems.org/specification-reference/#metadata" "Gradle" -> " Please make sure the published POM file includes the SCM connection, see: " + - "https://docs.gradle.org/current/userguide/publishing_maven.html#" + - "sec:modifying_the_generated_pom" + "https://docs.gradle.org/current/userguide/publishing_maven.html#" + + "sec:modifying_the_generated_pom" "Maven" -> " Please define the \"connection\" tag within the \"scm\" tag in the POM file, see: " + - "https://maven.apache.org/pom.html#SCM" + "https://maven.apache.org/pom.html#SCM" "NPM" -> " Please define the \"repository\" in the package.json file, see: " + - "https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository" + "https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository" "PIP", "PyPI" -> " Please make sure the setup.py defines the 'Source' attribute in 'project_urls', see: " + - "https://packaging.python.org/guides/distributing-packages-using-setuptools/#project-urls" + "https://packaging.python.org/guides/distributing-packages-using-setuptools/#project-urls" "SBT" -> " Please make sure the published POM file includes the SCM connection, see: " + - "https://maven.apache.org/pom.html#SCM" + "https://maven.apache.org/pom.html#SCM" else -> "" } diff --git a/downloader/src/main/kotlin/VcsHost.kt b/downloader/src/main/kotlin/VcsHost.kt index 2b92010df383..dae4d396ee30 100644 --- a/downloader/src/main/kotlin/VcsHost.kt +++ b/downloader/src/main/kotlin/VcsHost.kt @@ -80,10 +80,10 @@ enum class VcsHost( }.orEmpty() return "https://dev.azure.com/$userOrOrg/$team/_apis/git/repositories/" + - "$project/items?path=/" + - "&versionDescriptor[version]=${vcsInfo.revision}" + - "&versionDescriptor[versionType]=commit" + - "&\$format=zip&download=true" + "$project/items?path=/" + + "&versionDescriptor[version]=${vcsInfo.revision}" + + "&versionDescriptor[versionType]=commit" + + "&\$format=zip&download=true" } override fun toRawDownloadUrlInternal(userOrOrg: String, project: String, vcsInfo: VcsInfo): String { @@ -93,7 +93,7 @@ enum class VcsHost( }.orEmpty() return "https://dev.azure.com/$userOrOrg/$team/_apis/git/repositories/$project/items" + - "?scopePath=/${vcsInfo.path}" + "?scopePath=/${vcsInfo.path}" } /** @@ -307,11 +307,11 @@ enum class VcsHost( override fun toArchiveDownloadUrlInternal(userOrOrg: String, project: String, vcsInfo: VcsInfo) = "https://${vcsInfo.type.toString().lowercase()}.$hostname/~$userOrOrg/$project/archive/" + - "${vcsInfo.revision}.tar.gz" + "${vcsInfo.revision}.tar.gz" override fun toRawDownloadUrlInternal(userOrOrg: String, project: String, vcsInfo: VcsInfo) = "https://${vcsInfo.type.toString().lowercase()}.$hostname/~$userOrOrg/$project/blob/${vcsInfo.revision}/" + - vcsInfo.path + vcsInfo.path }; companion object { diff --git a/downloader/src/main/kotlin/VersionControlSystem.kt b/downloader/src/main/kotlin/VersionControlSystem.kt index 156ee5655b51..158dbe8bbd25 100644 --- a/downloader/src/main/kotlin/VersionControlSystem.kt +++ b/downloader/src/main/kotlin/VersionControlSystem.kt @@ -61,8 +61,8 @@ abstract class VersionControlSystem( */ fun forType(vcsType: VcsType) = ALL.find { - it.isAvailable() && it.isApplicableType(vcsType) - } + it.isAvailable() && it.isApplicableType(vcsType) + } /** * A map to cache the [VersionControlSystem], if any, for previously queried URLs. This helps to speed up @@ -125,7 +125,7 @@ abstract class VersionControlSystem( logger.debug { "Exception while validating ${it.vcsType} working tree, treating it as non-applicable: " + - e.collectMessages() + e.collectMessages() } false @@ -266,7 +266,7 @@ abstract class VersionControlSystem( if (it.isNotBlank() && !workingTree.workingDir.resolve(it).exists()) { throw DownloadException( "The $type working directory at '${workingTree.workingDir}' does not contain the requested path " + - "'$it'." + "'$it'." ) } } @@ -308,7 +308,7 @@ abstract class VersionControlSystem( if (it !in revisionCandidates) { logger.info { "Adding $type revision '$it' (guessed from package '$project' and version '$version') as " + - "a candidate." + "a candidate." } revisionCandidates += it @@ -317,7 +317,7 @@ abstract class VersionControlSystem( }.onFailure { logger.info { "No $type revision for package '$project' and version '$version' found: " + - it.collectMessages() + it.collectMessages() } emptyRevisionCandidatesException.addSuppressed(it) @@ -401,8 +401,8 @@ abstract class VersionControlSystem( fun isFixedRevision(workingTree: WorkingTree, revision: String): Result = runCatching { revision.isNotBlank() - && revision !in latestRevisionNames - && (revision !in workingTree.listRemoteBranches() || revision in workingTree.listRemoteTags()) + && revision !in latestRevisionNames + && (revision !in workingTree.listRemoteBranches() || revision in workingTree.listRemoteTags()) } /** diff --git a/downloader/src/main/kotlin/WorkingTree.kt b/downloader/src/main/kotlin/WorkingTree.kt index 1b28e97ea2e1..1f79c7a6192f 100644 --- a/downloader/src/main/kotlin/WorkingTree.kt +++ b/downloader/src/main/kotlin/WorkingTree.kt @@ -95,7 +95,7 @@ abstract class WorkingTree(val workingDir: File, val vcsType: VcsType) { versionNames.isEmpty() -> throw IOException( "No matching tag for version '$version' found in $remoteTags. Please create a tag whose name " + - "contains the version." + "contains the version." ) versionNames.size > 1 -> throw IOException( diff --git a/downloader/src/main/kotlin/vcs/Git.kt b/downloader/src/main/kotlin/vcs/Git.kt index 1779005b03cd..3c8abda13f21 100644 --- a/downloader/src/main/kotlin/vcs/Git.kt +++ b/downloader/src/main/kotlin/vcs/Git.kt @@ -122,10 +122,10 @@ class Git : VersionControlSystem(), CommandLineTool { override fun getWorkingTree(vcsDirectory: File): WorkingTree = GitWorkingTree( - workingDir = vcsDirectory, - vcsType = type, - repositoryUrlPrefixReplacements = REPOSITORY_URL_PREFIX_REPLACEMENTS - ) + workingDir = vcsDirectory, + vcsType = type, + repositoryUrlPrefixReplacements = REPOSITORY_URL_PREFIX_REPLACEMENTS + ) override fun isApplicableUrlInternal(vcsUrl: String): Boolean = runCatching { diff --git a/downloader/src/main/kotlin/vcs/Mercurial.kt b/downloader/src/main/kotlin/vcs/Mercurial.kt index 57688b1d38a4..e82a85faef6d 100644 --- a/downloader/src/main/kotlin/vcs/Mercurial.kt +++ b/downloader/src/main/kotlin/vcs/Mercurial.kt @@ -78,7 +78,7 @@ class Mercurial : VersionControlSystem(MercurialCommand) { default = ${vcs.url} [extensions] - """.trimIndent() + extensionsList.joinToString("\n") + """.trimIndent() + extensionsList.joinToString("\n") ) if (MERCURIAL_SPARSE_EXTENSION in extensionsList) { diff --git a/downloader/src/main/kotlin/vcs/Subversion.kt b/downloader/src/main/kotlin/vcs/Subversion.kt index 587806e68132..6d6aabf98412 100644 --- a/downloader/src/main/kotlin/vcs/Subversion.kt +++ b/downloader/src/main/kotlin/vcs/Subversion.kt @@ -175,7 +175,7 @@ class Subversion : VersionControlSystem() { logger.warn { "Failed to update the $type working tree at '${workingTree.workingDir}' to revision '$revision':\n" + - it.collectMessages() + it.collectMessages() } }.map { revision diff --git a/downloader/src/test/kotlin/VcsHostTest.kt b/downloader/src/test/kotlin/VcsHostTest.kt index badd49b88836..881f068e8f95 100644 --- a/downloader/src/test/kotlin/VcsHostTest.kt +++ b/downloader/src/test/kotlin/VcsHostTest.kt @@ -36,7 +36,7 @@ import org.ossreviewtoolkit.model.VcsType class VcsHostTest : WordSpec({ "The Azure DevOps implementation" should { val projectUrl = "https://dev.azure.com/oss-review-toolkit/kotlin-devs/_git/ort?path=/README.md" + - "&version=GC0000000000000000000000000000000000000000" + "&version=GC0000000000000000000000000000000000000000" val vcsInfo = VcsInfo( type = VcsType.GIT, url = "https://dev.azure.com/oss-review-toolkit/kotlin-devs/_git/ort", @@ -58,34 +58,34 @@ class VcsHostTest : WordSpec({ "be able to create permalinks from VCS information" { AZURE_DEVOPS.toPermalink(vcsInfo, 1) shouldBe "https://dev.azure.com/oss-review-toolkit/kotlin-devs/_git/" + - "ort?line=1&lineEnd=2" + - "&lineStartColumn=1&lineEndColumn=1" + - "&path=/README.md" + - "&version=GC0000000000000000000000000000000000000000" + "ort?line=1&lineEnd=2" + + "&lineStartColumn=1&lineEndColumn=1" + + "&path=/README.md" + + "&version=GC0000000000000000000000000000000000000000" AZURE_DEVOPS.toPermalink(vcsInfo, 1, 3) shouldBe "https://dev.azure.com/oss-review-toolkit/kotlin-devs/" + - "_git/ort?line=1&lineEnd=4" + - "&lineStartColumn=1&lineEndColumn=1" + - "&path=/README.md" + - "&version=GC0000000000000000000000000000000000000000" + "_git/ort?line=1&lineEnd=4" + + "&lineStartColumn=1&lineEndColumn=1" + + "&path=/README.md" + + "&version=GC0000000000000000000000000000000000000000" } "be able to create source archive links from project URLs" { AZURE_DEVOPS.toArchiveDownloadUrl(vcsInfo) shouldBe "https://dev.azure.com/oss-review-toolkit/" + - "kotlin-devs/_apis/git/repositories/ort/items?path=/" + - "&versionDescriptor[version]=0000000000000000000000000000000000000000" + - "&versionDescriptor[versionType]=commit" + - "&\$format=zip&download=true" + "kotlin-devs/_apis/git/repositories/ort/items?path=/" + + "&versionDescriptor[version]=0000000000000000000000000000000000000000" + + "&versionDescriptor[versionType]=commit" + + "&\$format=zip&download=true" } "be able to create raw download URLs from file URLs" { AZURE_DEVOPS.toRawDownloadUrl(projectUrl) shouldBe "https://dev.azure.com/oss-review-toolkit/kotlin-devs/" + - "_apis/git/repositories/ort/items?scopePath=/README.md" + "_apis/git/repositories/ort/items?scopePath=/README.md" } "not be applicable to a URL pointing to a package registry" { val url = "https://pkgs.dev.azure.com/project/0123456789/_packaging/some-npm-registry/" + - "npm/registry/apkg/-/apkg-1.2.3.tgz" + "npm/registry/apkg/-/apkg-1.2.3.tgz" VcsHost.fromUrl(url) should beNull() } @@ -93,7 +93,7 @@ class VcsHostTest : WordSpec({ "The Bitbucket implementation" should { val projectUrl = "https://bitbucket.org/yevster/spdxtraxample/" + - "src/287aebca5e7ff4167af1fb648640dcdbdf4ec666/LICENSE.txt" + "src/287aebca5e7ff4167af1fb648640dcdbdf4ec666/LICENSE.txt" val vcsInfo = VcsInfo( type = VcsType.GIT, url = "https://bitbucket.org/yevster/spdxtraxample.git", @@ -115,14 +115,14 @@ class VcsHostTest : WordSpec({ "be able to create permalinks from VCS information" { BITBUCKET.toPermalink(vcsInfo, 1) shouldBe "https://bitbucket.org/yevster/spdxtraxample/" + - "src/287aebca5e7ff4167af1fb648640dcdbdf4ec666/LICENSE.txt#lines-1" + "src/287aebca5e7ff4167af1fb648640dcdbdf4ec666/LICENSE.txt#lines-1" BITBUCKET.toPermalink(vcsInfo, 4, 8) shouldBe "https://bitbucket.org/yevster/spdxtraxample/" + - "src/287aebca5e7ff4167af1fb648640dcdbdf4ec666/LICENSE.txt#lines-4:8" + "src/287aebca5e7ff4167af1fb648640dcdbdf4ec666/LICENSE.txt#lines-4:8" } "be able to create source archive links from project URLs" { BITBUCKET.toArchiveDownloadUrl(vcsInfo) shouldBe - "https://bitbucket.org/yevster/spdxtraxample/get/287aebca5e7ff4167af1fb648640dcdbdf4ec666.tar.gz" + "https://bitbucket.org/yevster/spdxtraxample/get/287aebca5e7ff4167af1fb648640dcdbdf4ec666.tar.gz" } "be able to create raw download URLs from file URLs" { @@ -134,7 +134,7 @@ class VcsHostTest : WordSpec({ "The GitHub implementation" should { val projectUrl = "https://github.com/oss-review-toolkit/ort/" + - "blob/da7e3a814fc0e6301bf3ed394eba1a661e4d88d7/README.md" + "blob/da7e3a814fc0e6301bf3ed394eba1a661e4d88d7/README.md" val vcsInfo = VcsInfo( type = VcsType.GIT, url = "https://github.com/oss-review-toolkit/ort.git", @@ -163,21 +163,21 @@ class VcsHostTest : WordSpec({ ) GITHUB.toPermalink(scpVcsInfo, 3) shouldBe "https://github.com/oss-review-toolkit/ort/" + - "tree/4a836c3a6a42d358362fa07b014b7d83572a13ed/docs/examples/gradle.ort.yml#L3" + "tree/4a836c3a6a42d358362fa07b014b7d83572a13ed/docs/examples/gradle.ort.yml#L3" GITHUB.toPermalink(scpVcsInfo, 3, 5) shouldBe "https://github.com/oss-review-toolkit/ort/" + - "tree/4a836c3a6a42d358362fa07b014b7d83572a13ed/docs/examples/gradle.ort.yml#L3-L5" + "tree/4a836c3a6a42d358362fa07b014b7d83572a13ed/docs/examples/gradle.ort.yml#L3-L5" } "be able to create permalinks to Markdown files" { GITHUB.toPermalink(vcsInfo, 27) shouldBe "https://github.com/oss-review-toolkit/ort/" + - "blame/da7e3a814fc0e6301bf3ed394eba1a661e4d88d7/README.md#L27" + "blame/da7e3a814fc0e6301bf3ed394eba1a661e4d88d7/README.md#L27" GITHUB.toPermalink(vcsInfo, 27, 28) shouldBe "https://github.com/oss-review-toolkit/ort/" + - "blame/da7e3a814fc0e6301bf3ed394eba1a661e4d88d7/README.md#L27-L28" + "blame/da7e3a814fc0e6301bf3ed394eba1a661e4d88d7/README.md#L27-L28" } "be able to create source archive links from project URLs" { GITHUB.toArchiveDownloadUrl(vcsInfo) shouldBe - "https://github.com/oss-review-toolkit/ort/archive/da7e3a814fc0e6301bf3ed394eba1a661e4d88d7.tar.gz" + "https://github.com/oss-review-toolkit/ort/archive/da7e3a814fc0e6301bf3ed394eba1a661e4d88d7.tar.gz" } "be able to create raw download URLs from file URLs" { @@ -229,22 +229,22 @@ class VcsHostTest : WordSpec({ ) GITLAB.toPermalink(scpVcsInfo, 7) shouldBe "https://gitlab.com/mbunkus/mkvtoolnix/" + - "tree/12542c481ff1e0abcf8d561d6741e561ef5675ca/autogen.sh#L7" + "tree/12542c481ff1e0abcf8d561d6741e561ef5675ca/autogen.sh#L7" GITLAB.toPermalink(scpVcsInfo, 7, 9) shouldBe "https://gitlab.com/mbunkus/mkvtoolnix/" + - "tree/12542c481ff1e0abcf8d561d6741e561ef5675ca/autogen.sh#L7-9" + "tree/12542c481ff1e0abcf8d561d6741e561ef5675ca/autogen.sh#L7-9" } "be able to create permalinks to Markdown files" { GITLAB.toPermalink(vcsInfo, 5) shouldBe "https://gitlab.com/mbunkus/mkvtoolnix/" + - "blame/ec80478f87f1941fe52f15c5f4fa7ee6a70d7006/NEWS.md#L5" + "blame/ec80478f87f1941fe52f15c5f4fa7ee6a70d7006/NEWS.md#L5" GITLAB.toPermalink(vcsInfo, 5, 7) shouldBe "https://gitlab.com/mbunkus/mkvtoolnix/" + - "blame/ec80478f87f1941fe52f15c5f4fa7ee6a70d7006/NEWS.md#L5-7" + "blame/ec80478f87f1941fe52f15c5f4fa7ee6a70d7006/NEWS.md#L5-7" } "be able to create source archive links from project URLs" { GITLAB.toArchiveDownloadUrl(vcsInfo) shouldBe - "https://gitlab.com/mbunkus/mkvtoolnix/-/archive/ec80478f87f1941fe52f15c5f4fa7ee6a70d7006/" + - "mkvtoolnix-ec80478f87f1941fe52f15c5f4fa7ee6a70d7006.tar.gz" + "https://gitlab.com/mbunkus/mkvtoolnix/-/archive/ec80478f87f1941fe52f15c5f4fa7ee6a70d7006/" + + "mkvtoolnix-ec80478f87f1941fe52f15c5f4fa7ee6a70d7006.tar.gz" } "be able to create raw download URLs from file URLs" { @@ -289,14 +289,14 @@ class VcsHostTest : WordSpec({ "be able to create permalinks from Git VCS information" { SOURCEHUT.toPermalink(gitVcsInfo, 26) shouldBe - "https://git.sr.ht/~ben/web/tree/2c3d173d/assets/css/main.css#L26" + "https://git.sr.ht/~ben/web/tree/2c3d173d/assets/css/main.css#L26" SOURCEHUT.toPermalink(gitVcsInfo, 26, 29) shouldBe - "https://git.sr.ht/~ben/web/tree/2c3d173d/assets/css/main.css#L26-29" + "https://git.sr.ht/~ben/web/tree/2c3d173d/assets/css/main.css#L26-29" } "be able to create permalinks from Mercurial VCS information" { SOURCEHUT.toPermalink(hgVcsInfo, 9) shouldBe - "https://hg.sr.ht/~duangle/paniq_legacy/browse/f04521a92844/masagin/README.txt#L9" + "https://hg.sr.ht/~duangle/paniq_legacy/browse/f04521a92844/masagin/README.txt#L9" // SourceHut does not support an end line in permalinks to Mercurial repos. } diff --git a/evaluator/src/main/kotlin/DependencyRule.kt b/evaluator/src/main/kotlin/DependencyRule.kt index a776cefb8b17..ed763e41a6cc 100644 --- a/evaluator/src/main/kotlin/DependencyRule.kt +++ b/evaluator/src/main/kotlin/DependencyRule.kt @@ -65,7 +65,7 @@ class DependencyRule( ) : PackageRule(ruleSet, name, pkg, resolvedLicenseInfo) { override val description = "Evaluating rule '$name' for dependency '${dependency.id.toCoordinates()}' " + - "(project=${project.id.toCoordinates()}, scope=$scopeName, level=$level)." + "(project=${project.id.toCoordinates()}, scope=$scopeName, level=$level)." override fun issueSource() = "$name - ${pkg.metadata.id.toCoordinates()} (dependency of ${project.id.toCoordinates()} in scope $scopeName)" diff --git a/evaluator/src/main/kotlin/PackageRule.kt b/evaluator/src/main/kotlin/PackageRule.kt index 848255970e9a..411a87033980 100644 --- a/evaluator/src/main/kotlin/PackageRule.kt +++ b/evaluator/src/main/kotlin/PackageRule.kt @@ -218,7 +218,7 @@ open class PackageRule( fun pkg() = pkg override val description = "\tEvaluating license rule '$name' for $licenseSource license " + - "'${resolvedLicense.license}'." + "'${resolvedLicense.license}'." override fun issueSource() = "$name - ${pkg.metadata.id.toCoordinates()} - ${resolvedLicense.license} ($licenseSource)" diff --git a/evaluator/src/main/kotlin/Rule.kt b/evaluator/src/main/kotlin/Rule.kt index c67e94b2572b..3ae18c22aa77 100644 --- a/evaluator/src/main/kotlin/Rule.kt +++ b/evaluator/src/main/kotlin/Rule.kt @@ -68,11 +68,11 @@ abstract class Rule( */ private fun matches() = matchers.all { matcher -> - matcher.matches().also { matches -> - logger.info { "\t${matcher.description} == $matches" } - if (!matches) logger.info { "\tRule skipped." } + matcher.matches().also { matches -> + logger.info { "\t${matcher.description} == $matches" } + if (!matches) logger.info { "\tRule skipped." } + } } - } /** * Evaluate this rule by checking if all matchers apply. If this is the case all [violations] configured in this diff --git a/evaluator/src/test/kotlin/EvaluatorTest.kt b/evaluator/src/test/kotlin/EvaluatorTest.kt index 2d7a1dbdbd30..58c56d357241 100644 --- a/evaluator/src/test/kotlin/EvaluatorTest.kt +++ b/evaluator/src/test/kotlin/EvaluatorTest.kt @@ -185,20 +185,20 @@ class EvaluatorTest : WordSpec({ result.violations.map { it.message } shouldContainExactlyInAnyOrder listOf( "The outbound license AGPL-3.0-or-later of project 'Maven:group:project-foo:1' is incompatible " + - "with the inbound license AGPL-3.0-only of its dependency " + - "'Maven:group:package-foo-transitive:1'. Software under a copyleft license such as the " + - "AGPL-3.0-only license normally cannot be redistributed under another copyleft license such " + - "as the AGPL-3.0-or-later license, except if it were explicitly permitted in the licenses.", + "with the inbound license AGPL-3.0-only of its dependency " + + "'Maven:group:package-foo-transitive:1'. Software under a copyleft license such as the " + + "AGPL-3.0-only license normally cannot be redistributed under another copyleft license such " + + "as the AGPL-3.0-or-later license, except if it were explicitly permitted in the licenses.", "The outbound license AGPL-3.0-or-later of project 'Maven:group:project-bar:1' is incompatible " + - "with the inbound license AGPL-3.0-only of its dependency " + - "'Maven:group:package-bar-direct:1'. Software under a copyleft license such as the " + - "AGPL-3.0-only license normally cannot be redistributed under another copyleft license such " + - "as the AGPL-3.0-or-later license, except if it were explicitly permitted in the licenses.", + "with the inbound license AGPL-3.0-only of its dependency " + + "'Maven:group:package-bar-direct:1'. Software under a copyleft license such as the " + + "AGPL-3.0-only license normally cannot be redistributed under another copyleft license such " + + "as the AGPL-3.0-or-later license, except if it were explicitly permitted in the licenses.", "The outbound license AGPL-3.0-or-later of project 'Maven:group:project-bar:1' is incompatible " + - "with the inbound license AGPL-3.0-only of its dependency " + - "'Maven:group:package-bar-direct:2'. Software under a copyleft license such as the " + - "AGPL-3.0-only license normally cannot be redistributed under another copyleft license such " + - "as the AGPL-3.0-or-later license, except if it were explicitly permitted in the licenses." + "with the inbound license AGPL-3.0-only of its dependency " + + "'Maven:group:package-bar-direct:2'. Software under a copyleft license such as the " + + "AGPL-3.0-only license normally cannot be redistributed under another copyleft license such " + + "as the AGPL-3.0-or-later license, except if it were explicitly permitted in the licenses." ) } @@ -218,11 +218,11 @@ class EvaluatorTest : WordSpec({ result.violations should haveSize(1) result.violations.first().message shouldBe "The outbound license Apache-2.0 of project " + - "'Maven:group:project-name:1' is incompatible with the inbound license GPL-2.0-only " + - "(simplified from 'GPL-2.0-only WITH Classpath-exception-2.0') of its dependency " + - "'Maven:group:package-name:1'. Software under a copyleft license such as the GPL-2.0-only " + - "license normally cannot be redistributed under a non-copyleft license such as the Apache-2.0 " + - "license, except if it were explicitly permitted in the licenses." + "'Maven:group:project-name:1' is incompatible with the inbound license GPL-2.0-only " + + "(simplified from 'GPL-2.0-only WITH Classpath-exception-2.0') of its dependency " + + "'Maven:group:package-name:1'. Software under a copyleft license such as the GPL-2.0-only " + + "license normally cannot be redistributed under a non-copyleft license such as the Apache-2.0 " + + "license, except if it were explicitly permitted in the licenses." } } }) diff --git a/evaluator/src/test/kotlin/RuleTest.kt b/evaluator/src/test/kotlin/RuleTest.kt index 465061265443..7ae8f601008c 100644 --- a/evaluator/src/test/kotlin/RuleTest.kt +++ b/evaluator/src/test/kotlin/RuleTest.kt @@ -39,9 +39,9 @@ class RuleTest : WordSpec() { private fun createRule() = object : Rule(ruleSet, "test") { - override val description = "test" - override fun issueSource() = name - } + override val description = "test" + override fun issueSource() = name + } init { "hint" should { @@ -105,9 +105,9 @@ class RuleTest : WordSpec() { "add the expected matchers" { fun matcher() = object : RuleMatcher { - override val description = "test" - override fun matches() = true - } + override val description = "test" + override fun matches() = true + } val rule = createRule() diff --git a/helper-cli/src/main/kotlin/commands/CreateAnalyzerResultCommand.kt b/helper-cli/src/main/kotlin/commands/CreateAnalyzerResultCommand.kt index 9acc0f04dd89..2999ec05775e 100644 --- a/helper-cli/src/main/kotlin/commands/CreateAnalyzerResultCommand.kt +++ b/helper-cli/src/main/kotlin/commands/CreateAnalyzerResultCommand.kt @@ -58,7 +58,7 @@ import org.ossreviewtoolkit.utils.ort.ortConfigDirectory internal class CreateAnalyzerResultCommand : CliktCommand( help = "Creates an analyzer result that contains packages for the given list of package ids. The result contains " + - "only packages which have a corresponding ScanCode scan result in the postgres storage." + "only packages which have a corresponding ScanCode scan result in the postgres storage." ) { private val packageIdsFile by option( "--package-ids-file", @@ -87,7 +87,7 @@ internal class CreateAnalyzerResultCommand : CliktCommand( private val configArguments by option( "-P", help = "Override a key-value pair in the configuration file. For example: " + - "-P ort.scanner.storages.postgres.connection.schema=testSchema" + "-P ort.scanner.storages.postgres.connection.schema=testSchema" ).associate() private val scancodeVersion by option( @@ -189,17 +189,17 @@ private fun getScannedPackages( private fun createAnalyzerResult(packages: Collection) = OrtResult.EMPTY.copy( - analyzer = AnalyzerRun( - startTime = Instant.now(), - endTime = Instant.now(), - environment = Environment(), - config = AnalyzerConfiguration(), - result = AnalyzerResult( - projects = emptySet(), - packages = packages.mapTo(mutableSetOf()) { it.toPackage() } + analyzer = AnalyzerRun( + startTime = Instant.now(), + endTime = Instant.now(), + environment = Environment(), + config = AnalyzerConfiguration(), + result = AnalyzerResult( + projects = emptySet(), + packages = packages.mapTo(mutableSetOf()) { it.toPackage() } + ) ) ) -) private fun Collection.filterMaxByRowId(): List { fun filterMaxByRowId(predicate: (ScannedPackage) -> Boolean) = diff --git a/helper-cli/src/main/kotlin/commands/DownloadResultsFromPostgresCommand.kt b/helper-cli/src/main/kotlin/commands/DownloadResultsFromPostgresCommand.kt index 84644b3124d4..473c6f6fc5fd 100644 --- a/helper-cli/src/main/kotlin/commands/DownloadResultsFromPostgresCommand.kt +++ b/helper-cli/src/main/kotlin/commands/DownloadResultsFromPostgresCommand.kt @@ -46,7 +46,7 @@ import org.ossreviewtoolkit.utils.ort.ortConfigDirectory internal class DownloadResultsFromPostgresCommand : CliktCommand( name = "download-results-from-postgres", help = "Download an ORT result from a PostgreSQL database. The symmetric command to ORT's " + - " upload-result-to-postgres command." + " upload-result-to-postgres command." ) { private val outputDir by option( "--output-dir", "-o", @@ -77,7 +77,7 @@ internal class DownloadResultsFromPostgresCommand : CliktCommand( private val configArguments by option( "-P", help = "Override a key-value pair in the configuration file. For example: " + - "-P ort.scanner.storages.postgres.connection.schema=testSchema" + "-P ort.scanner.storages.postgres.connection.schema=testSchema" ).associate() private val startId by option( @@ -183,7 +183,7 @@ private class OrtResultStorage(private val storageDir: File) { val ortResultFile = ortResultFile(id) return md5sumFile.isFile && ortResultFile.isFile && - HashAlgorithm.MD5.calculate(ortResultFile) == md5sumFile.readText() + HashAlgorithm.MD5.calculate(ortResultFile) == md5sumFile.readText() } private fun ortResultFile(id: Int): File = storageDir.resolve("$id/ort-result.json.xz") diff --git a/helper-cli/src/main/kotlin/commands/GetPackageLicensesCommand.kt b/helper-cli/src/main/kotlin/commands/GetPackageLicensesCommand.kt index 99ba7b7dfb5e..cb4e4bd46157 100644 --- a/helper-cli/src/main/kotlin/commands/GetPackageLicensesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/GetPackageLicensesCommand.kt @@ -56,7 +56,7 @@ internal class GetPackageLicensesCommand : CliktCommand( private val configArguments by option( "-P", help = "Override a key-value pair in the configuration file. For example: " + - "-P ort.scanner.storages.postgres.connection.schema=testSchema" + "-P ort.scanner.storages.postgres.connection.schema=testSchema" ).associate() private val packageId by option( @@ -68,7 +68,7 @@ internal class GetPackageLicensesCommand : CliktCommand( private val packageConfigurationsDir by option( "--package-configurations-dir", help = "A directory that is searched recursively for package configuration files. Each file must only " + - "contain a single package configuration." + "contain a single package configuration." ).file(mustExist = true, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = true) .convert { it.expandTilde() } diff --git a/helper-cli/src/main/kotlin/commands/ImportCopyrightGarbageCommand.kt b/helper-cli/src/main/kotlin/commands/ImportCopyrightGarbageCommand.kt index 73ffbcc7de01..3ff0f570ce50 100644 --- a/helper-cli/src/main/kotlin/commands/ImportCopyrightGarbageCommand.kt +++ b/helper-cli/src/main/kotlin/commands/ImportCopyrightGarbageCommand.kt @@ -38,7 +38,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class ImportCopyrightGarbageCommand : CliktCommand( help = "Import copyright garbage from a plain text file containing one copyright statement per line into the " + - "given copyright garbage file." + "given copyright garbage file." ) { private val inputCopyrightGarbageFile by option( "--input-copyright-garbage-file", "-i", diff --git a/helper-cli/src/main/kotlin/commands/ListCopyrightsCommand.kt b/helper-cli/src/main/kotlin/commands/ListCopyrightsCommand.kt index 07620c3e7a0d..798e46bc9df8 100644 --- a/helper-cli/src/main/kotlin/commands/ListCopyrightsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/ListCopyrightsCommand.kt @@ -71,7 +71,7 @@ internal class ListCopyrightsCommand : CliktCommand( private val packageConfigurationsDir by option( "--package-configurations-dir", help = "A directory that is searched recursively for package configuration files. Each file must only " + - "contain a single package configuration." + "contain a single package configuration." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = true) diff --git a/helper-cli/src/main/kotlin/commands/ListLicensesCommand.kt b/helper-cli/src/main/kotlin/commands/ListLicensesCommand.kt index d2e83ae9478d..77054d9e11dd 100644 --- a/helper-cli/src/main/kotlin/commands/ListLicensesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/ListLicensesCommand.kt @@ -69,8 +69,8 @@ internal class ListLicensesCommand : CliktCommand( private val sourceCodeDir by option( "--source-code-dir", help = "A directory containing the sources for the target package. These sources should match the provenance " + - "of the respective scan result in the ORT result. If not specified those sources are downloaded if " + - "needed." + "of the respective scan result in the ORT result. If not specified those sources are downloaded if " + + "needed." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -78,13 +78,13 @@ internal class ListLicensesCommand : CliktCommand( private val offendingOnly by option( "--offending-only", help = "Only list licenses causing at least one rule violation with an offending severity, see " + - "--offending-severities." + "--offending-severities." ).flag() private val offendingSeverities by option( "--offending-severities", help = "Set the severities to use for the filtering enabled by --offending-only, specified as " + - "comma-separated values." + "comma-separated values." ).enum().split(",").default(Severity.entries) private val omitExcluded by option( @@ -110,7 +110,7 @@ internal class ListLicensesCommand : CliktCommand( private val decomposeLicenseExpressions by option( "--decompose-license-expressions", help = "Decompose SPDX license expressions into its single licenses components and list the findings for " + - "each single license separately." + "each single license separately." ).flag() private val repositoryConfigurationFile by option( @@ -123,7 +123,7 @@ internal class ListLicensesCommand : CliktCommand( private val packageConfigurationsDir by option( "--package-configurations-dir", help = "A directory that is searched recursively for package configuration files. Each file must only " + - "contain a single package configuration." + "contain a single package configuration." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = true) @@ -177,7 +177,7 @@ internal class ListLicensesCommand : CliktCommand( val isAllowedFile = fileAllowList.isEmpty() || FileMatcher.match(fileAllowList, location.path) val isIncluded = !omitExcluded || !isPathExcluded(provenance, location.path) || - ignoreExcludedRuleIds.intersect(violatedRulesByLicense[license].orEmpty()).isNotEmpty() + ignoreExcludedRuleIds.intersect(violatedRulesByLicense[license].orEmpty()).isNotEmpty() isAllowedFile && isIncluded } @@ -280,7 +280,7 @@ private fun Collection.groupByText(baseDir: File): List TextLocationGroup(locations = locations, text = text) } + - unresolvedLocations.map { TextLocationGroup(locations = setOf(it)) } + unresolvedLocations.map { TextLocationGroup(locations = setOf(it)) } } private fun TextLocation.resolve(baseDir: File): String? { diff --git a/helper-cli/src/main/kotlin/commands/ListPackagesCommand.kt b/helper-cli/src/main/kotlin/commands/ListPackagesCommand.kt index 433a117ef5e1..1d809a814e57 100644 --- a/helper-cli/src/main/kotlin/commands/ListPackagesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/ListPackagesCommand.kt @@ -63,13 +63,13 @@ internal class ListPackagesCommand : CliktCommand( private val offendingOnly by option( "--offending-only", help = "Only list packages causing at least one rule violation with an offending severity, see " + - "--offending-severities." + "--offending-severities." ).flag() private val offendingSeverities by option( "--offending-severities", help = "Set the severities to use for the filtering enabled by --offending-only, specified as " + - "comma-separated values." + "comma-separated values." ).enum().split(",").default(Severity.entries) override fun run() { diff --git a/helper-cli/src/main/kotlin/commands/ListStoredScanResultsCommand.kt b/helper-cli/src/main/kotlin/commands/ListStoredScanResultsCommand.kt index db5b041dc59a..7790ec689f10 100644 --- a/helper-cli/src/main/kotlin/commands/ListStoredScanResultsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/ListStoredScanResultsCommand.kt @@ -57,7 +57,7 @@ internal class ListStoredScanResultsCommand : CliktCommand( private val configArguments by option( "-P", help = "Override a key-value pair in the configuration file. For example: " + - "-P ort.scanner.storages.postgres.connection.schema=testSchema" + "-P ort.scanner.storages.postgres.connection.schema=testSchema" ).associate() override fun run() { diff --git a/helper-cli/src/main/kotlin/commands/MapCopyrightsCommand.kt b/helper-cli/src/main/kotlin/commands/MapCopyrightsCommand.kt index 936c46bd843b..e8cb10d80b6b 100644 --- a/helper-cli/src/main/kotlin/commands/MapCopyrightsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/MapCopyrightsCommand.kt @@ -32,7 +32,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class MapCopyrightsCommand : CliktCommand( help = "Reads processed copyright statements from the input file, maps them to unprocessed copyright statements " + - "using the given ORT file, and writes those mapped statements to the given output file." + "using the given ORT file, and writes those mapped statements to the given output file." ) { private val inputCopyrightGarbageFile by option( "--input-copyrights-file", "-i", diff --git a/helper-cli/src/main/kotlin/commands/MergeRepositoryConfigurationsCommand.kt b/helper-cli/src/main/kotlin/commands/MergeRepositoryConfigurationsCommand.kt index f2e4b9b58e84..62c93df28983 100644 --- a/helper-cli/src/main/kotlin/commands/MergeRepositoryConfigurationsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/MergeRepositoryConfigurationsCommand.kt @@ -36,7 +36,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class MergeRepositoryConfigurationsCommand : CliktCommand( help = "Merges the given list of input repository configuration files and writes the result to the given output " + - "repository configuration file." + "repository configuration file." ) { private val inputRepositoryConfigurationFiles by option( "--input-repository-configuration-files", "-i", diff --git a/helper-cli/src/main/kotlin/commands/SetDependencyRepresentationCommand.kt b/helper-cli/src/main/kotlin/commands/SetDependencyRepresentationCommand.kt index 6aa0352b6d36..5adbd6fd4c97 100644 --- a/helper-cli/src/main/kotlin/commands/SetDependencyRepresentationCommand.kt +++ b/helper-cli/src/main/kotlin/commands/SetDependencyRepresentationCommand.kt @@ -108,8 +108,8 @@ internal class SetDependencyRepresentationCommand : CliktCommand( private val ortFile by option( "--ort-file", "-i", help = "The ORT result file to read as input. This can be the serialized form of an OrtResult, an " + - "AnalyzerResult, or a ProjectAnalyzerResult. NOTE: If no output file is specified, this file is " + - "overwritten." + "AnalyzerResult, or a ProjectAnalyzerResult. NOTE: If no output file is specified, this file is " + + "overwritten." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/SetLabelsCommand.kt b/helper-cli/src/main/kotlin/commands/SetLabelsCommand.kt index c66336a4568a..3c1aecf3304b 100644 --- a/helper-cli/src/main/kotlin/commands/SetLabelsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/SetLabelsCommand.kt @@ -54,7 +54,7 @@ internal class SetLabelsCommand : CliktCommand( private val labels by option( "--label", "-l", help = "Set a label in the ORT result, overwriting any existing label of the same name. Can be used multiple " + - "times. For example: --label distribution=external" + "times. For example: --label distribution=external" ).associate() private val removeExistingLabels by option( @@ -66,7 +66,7 @@ internal class SetLabelsCommand : CliktCommand( var ortResult = readOrtResult(inputOrtFile) if (removeExistingLabels) { - ortResult = ortResult.copy(labels = emptyMap()) + ortResult = ortResult.copy(labels = emptyMap()) } writeOrtResult(ortResult.mergeLabels(labels), outputOrtFile) diff --git a/helper-cli/src/main/kotlin/commands/classifications/FilterCommand.kt b/helper-cli/src/main/kotlin/commands/classifications/FilterCommand.kt index 9cd6c111bc1e..214267863be1 100644 --- a/helper-cli/src/main/kotlin/commands/classifications/FilterCommand.kt +++ b/helper-cli/src/main/kotlin/commands/classifications/FilterCommand.kt @@ -45,7 +45,7 @@ internal class FilterCommand : CliktCommand( private val keepLicenseCategories by option( "--keep-categories", "-k", help = "The comma separated license categories for which the corresponding categorization shall be kept. All " + - "categories corresponding to the kept categorizations will also be kept." + "categories corresponding to the kept categorizations will also be kept." ).convert { it.expandTilde() }.split(",").required() override fun run() { diff --git a/helper-cli/src/main/kotlin/commands/classifications/ImportCommand.kt b/helper-cli/src/main/kotlin/commands/classifications/ImportCommand.kt index 6e29878b50ea..08240ed017ba 100644 --- a/helper-cli/src/main/kotlin/commands/classifications/ImportCommand.kt +++ b/helper-cli/src/main/kotlin/commands/classifications/ImportCommand.kt @@ -47,7 +47,7 @@ internal class ImportCommand : CliktCommand( ) { private val provider by argument( help = "The name of the provider to import license classifications from. Must be one of " + - "${LicenseClassificationProvider.entries.map { it.name }}." + "${LicenseClassificationProvider.entries.map { it.name }}." ).enum() private val prefix by option( diff --git a/helper-cli/src/main/kotlin/commands/classifications/MergeCommand.kt b/helper-cli/src/main/kotlin/commands/classifications/MergeCommand.kt index 6a5f9e77a76f..02be864af073 100644 --- a/helper-cli/src/main/kotlin/commands/classifications/MergeCommand.kt +++ b/helper-cli/src/main/kotlin/commands/classifications/MergeCommand.kt @@ -40,7 +40,7 @@ internal class MergeCommand : CliktCommand( ) { private val licenseClassificationsFiles by argument( help = "The license classifications file to merge, in order. Existing classifications will be maintained " + - "unless they are redefined, in which case they will be overwritten." + "unless they are redefined, in which case they will be overwritten." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt b/helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt index 5f20624810f4..31f0be40d74e 100644 --- a/helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt @@ -45,9 +45,9 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class RewriteTestAssetsCommand : CliktCommand( help = "Searches all test assets directories in the given ORT sources directory for recognized serialized files " + - "and tries to de-serialize and serialize the file. The command can be used to update the test assets " + - "after making changes to the corresponding model classes or serializer configuration, e.g. after " + - "annotating a property to not be serialized if empty." + "and tries to de-serialize and serialize the file. The command can be used to update the test assets " + + "after making changes to the corresponding model classes or serializer configuration, e.g. after " + + "annotating a property to not be serialized if empty." ) { private val ortSourcesDir by option( "--ort-sources-dir", "-i", diff --git a/helper-cli/src/main/kotlin/commands/packageconfig/CreateCommand.kt b/helper-cli/src/main/kotlin/commands/packageconfig/CreateCommand.kt index eed9d9f20325..5c2ecd97e0b5 100644 --- a/helper-cli/src/main/kotlin/commands/packageconfig/CreateCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packageconfig/CreateCommand.kt @@ -50,8 +50,8 @@ import org.ossreviewtoolkit.utils.spdx.SpdxSingleLicenseExpression internal class CreateCommand : CliktCommand( help = "Creates one package configuration for the source artifact scan and one for the VCS scan, if " + - "a corresponding scan result exists in the given ORT result for the respective provenance. The output " + - "package configuration YAML files are written to the given output directory." + "a corresponding scan result exists in the given ORT result for the respective provenance. The output " + + "package configuration YAML files are written to the given output directory." ) { private val scanResultsStorageDir by option( "--scan-results-storage-dir", @@ -100,14 +100,14 @@ internal class CreateCommand : CliktCommand( private val nonOffendingLicenseCategories by option( "--non-offending-license-categories", help = "Specify licenses by their category which should be considered non-offending. Path excludes are not" + - "generated for files or directories which only contain non-offending licenses. Each category name " + - "must be present in the given license classifications file." + "generated for files or directories which only contain non-offending licenses. Each category name " + + "must be present in the given license classifications file." ).split(",").default(emptyList()) private val nonOffendingLicenseIds by option( "--non-offending-license-ids", help = "Specify license IDs which should be considered non-offending. Path excludes are not generated for " + - "files or directories which only contain non-offending licenses." + "files or directories which only contain non-offending licenses." ).split(",").default(emptyList()) private val noSkeletonFiles by option( @@ -202,14 +202,14 @@ internal class CreateCommand : CliktCommand( val licenseClassifications = licenseClassificationsFile?.readValue() ?: throw UsageError( message = "The license classifications file must be specified in order to resolve the given " + - "non-offending license category names to license IDs.", + "non-offending license category names to license IDs.", statusCode = 2 ) nonOffendingLicenseCategories.flatMapTo(result) { categoryName -> licenseClassifications.licensesByCategory[categoryName] ?: throw UsageError( message = "The given license category '$categoryName' was not found in " + - "'${licenseClassificationsFile!!.absolutePath}'.", + "'${licenseClassificationsFile!!.absolutePath}'.", statusCode = 2 ) } diff --git a/helper-cli/src/main/kotlin/commands/packageconfig/ExportLicenseFindingCurationsCommand.kt b/helper-cli/src/main/kotlin/commands/packageconfig/ExportLicenseFindingCurationsCommand.kt index 954326af9841..f3520ea20a11 100644 --- a/helper-cli/src/main/kotlin/commands/packageconfig/ExportLicenseFindingCurationsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packageconfig/ExportLicenseFindingCurationsCommand.kt @@ -40,7 +40,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class ExportLicenseFindingCurationsCommand : CliktCommand( help = "Export the license finding curations to a file which maps repository URLs to the license finding " + - "curations for the respective repository." + "curations for the respective repository." ) { private val packageConfigurationFile by option( "--package-configuration-file", @@ -61,7 +61,7 @@ internal class ExportLicenseFindingCurationsCommand : CliktCommand( private val updateOnlyExisting by option( "--update-only-existing", help = "If enabled, only entries are imported for which an entry already exists which differs only in terms " + - "of its concluded license, comment or reason." + "of its concluded license, comment or reason." ).flag() private val licenseFindingCurationsFile by option( @@ -75,7 +75,7 @@ internal class ExportLicenseFindingCurationsCommand : CliktCommand( private val vcsUrlMappingFile by option( "--vcs-url-mapping-file", help = "A YAML or JSON file containing a mapping of VCS URLs to other VCS URLs which will be replaced during " + - "the export." + "the export." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/packageconfig/ExportPathExcludesCommand.kt b/helper-cli/src/main/kotlin/commands/packageconfig/ExportPathExcludesCommand.kt index bef37d164aba..6d2f9374bb1a 100644 --- a/helper-cli/src/main/kotlin/commands/packageconfig/ExportPathExcludesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packageconfig/ExportPathExcludesCommand.kt @@ -40,7 +40,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class ExportPathExcludesCommand : CliktCommand( help = "Export the path excludes to a path excludes file which maps repository URLs to the path excludes for the " + - "respective repository" + "respective repository" ) { private val pathExcludesFile by option( "--path-excludes-file", @@ -74,7 +74,7 @@ internal class ExportPathExcludesCommand : CliktCommand( private val vcsUrlMappingFile by option( "--vcs-url-mapping-file", help = "A YAML or JSON file containing a mapping of VCS URLs to other VCS URLs which will be replaced during " + - "the export." + "the export." ).file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/packageconfig/FindCommand.kt b/helper-cli/src/main/kotlin/commands/packageconfig/FindCommand.kt index 067ce0ea8010..e7cbe8c5f211 100644 --- a/helper-cli/src/main/kotlin/commands/packageconfig/FindCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packageconfig/FindCommand.kt @@ -33,7 +33,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class FindCommand : CliktCommand( help = "Searches the given directory for a package configuration file matching the given identifier." + - "If found the absolute path is written to the output." + "If found the absolute path is written to the output." ) { private val packageId by option( "--package-id", @@ -44,7 +44,7 @@ internal class FindCommand : CliktCommand( private val packageConfigurationsDir by option( "--package-configurations-dir", help = "A directory that is searched recursively for package configuration files. Each file must only " + - "contain a single package configuration." + "contain a single package configuration." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/packageconfig/FormatCommand.kt b/helper-cli/src/main/kotlin/commands/packageconfig/FormatCommand.kt index c7011c0c396b..6e03595ef434 100644 --- a/helper-cli/src/main/kotlin/commands/packageconfig/FormatCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packageconfig/FormatCommand.kt @@ -31,7 +31,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class FormatCommand : CliktCommand( help = "Applies the formatting used by all ort-helper commands and strips all YAML comments. The output is " + - "written to the given package configuration file." + "written to the given package configuration file." ) { private val packageConfigurationFile by argument( "package-configuration-file", diff --git a/helper-cli/src/main/kotlin/commands/packageconfig/ImportLicenseFindingCurationsCommand.kt b/helper-cli/src/main/kotlin/commands/packageconfig/ImportLicenseFindingCurationsCommand.kt index 7f6b47127cc4..70b8bfed0727 100644 --- a/helper-cli/src/main/kotlin/commands/packageconfig/ImportLicenseFindingCurationsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packageconfig/ImportLicenseFindingCurationsCommand.kt @@ -42,7 +42,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class ImportLicenseFindingCurationsCommand : CliktCommand( help = "Import license finding curations from a license finding curations file and merge them into the given " - + "package configuration." + + "package configuration." ) { private val licenseFindingCurationsFile by option( "--license-finding-curations-file", @@ -79,13 +79,13 @@ internal class ImportLicenseFindingCurationsCommand : CliktCommand( private val updateOnlyExisting by option( "--update-only-existing", help = "If enabled, only entries are imported for which an entry already exists which differs only in terms " + - "of its concluded license, comment or reason." + "of its concluded license, comment or reason." ).flag() private val vcsUrlMappingFile by option( "--vcs-url-mapping-file", help = "A YAML or JSON file containing a mapping of VCS URLs to other VCS URLs which will be replaced during " + - "the import." + "the import." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/packageconfig/ImportPathExcludesCommand.kt b/helper-cli/src/main/kotlin/commands/packageconfig/ImportPathExcludesCommand.kt index dbeb07ea26f4..9e599b82e8e5 100644 --- a/helper-cli/src/main/kotlin/commands/packageconfig/ImportPathExcludesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packageconfig/ImportPathExcludesCommand.kt @@ -73,7 +73,7 @@ internal class ImportPathExcludesCommand : CliktCommand( private val vcsUrlMappingFile by option( "--vcs-url-mapping-file", help = "A YAML or JSON file containing a mapping of VCS URLs to other VCS URLs which will be replaced during " + - "the import." + "the import." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/packageconfig/RemoveEntriesCommand.kt b/helper-cli/src/main/kotlin/commands/packageconfig/RemoveEntriesCommand.kt index f8cdf2f8186a..427d518bb70d 100644 --- a/helper-cli/src/main/kotlin/commands/packageconfig/RemoveEntriesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packageconfig/RemoveEntriesCommand.kt @@ -48,7 +48,7 @@ internal class RemoveEntriesCommand : CliktCommand( private val ortFile by option( "--ort-file", help = "The ORT result file to read as input which should contain a scan result to which the given " + - "package configuration applies to." + "package configuration applies to." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -84,7 +84,7 @@ internal class RemoveEntriesCommand : CliktCommand( buildString { val removedPathExcludes = packageConfiguration.pathExcludes.size - pathExcludes.size val removedLicenseFindingCurations = packageConfiguration.licenseFindingCurations.size - - licenseFindingCurations.size + licenseFindingCurations.size appendLine("Removed entries:") appendLine() diff --git a/helper-cli/src/main/kotlin/commands/packageconfig/SortCommand.kt b/helper-cli/src/main/kotlin/commands/packageconfig/SortCommand.kt index 208ea907ec31..37981cda770f 100644 --- a/helper-cli/src/main/kotlin/commands/packageconfig/SortCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packageconfig/SortCommand.kt @@ -32,7 +32,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class SortCommand : CliktCommand( help = "Sorts all exclude and curation entries of the given package configuration alphabetically. The output " + - "is written to the given package configuration file." + "is written to the given package configuration file." ) { private val packageConfigurationFile by argument( "package-configuration-file", diff --git a/helper-cli/src/main/kotlin/commands/packagecuration/SetCommand.kt b/helper-cli/src/main/kotlin/commands/packagecuration/SetCommand.kt index 17303ca1a414..5e6e78c12001 100644 --- a/helper-cli/src/main/kotlin/commands/packagecuration/SetCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packagecuration/SetCommand.kt @@ -35,7 +35,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class SetCommand : CliktCommand( help = "(Re-)set all package curations for a given ORT file to the curations specified via package curations " + - "file and directory. If no curations are given then all curations get removed." + "file and directory. If no curations are given then all curations get removed." ) { private val ortFile by option( "--ort-file", "-i", diff --git a/helper-cli/src/main/kotlin/commands/repoconfig/ExportLicenseFindingCurationsCommand.kt b/helper-cli/src/main/kotlin/commands/repoconfig/ExportLicenseFindingCurationsCommand.kt index cae1a17116af..5ffc5aa6e629 100644 --- a/helper-cli/src/main/kotlin/commands/repoconfig/ExportLicenseFindingCurationsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/repoconfig/ExportLicenseFindingCurationsCommand.kt @@ -40,7 +40,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class ExportLicenseFindingCurationsCommand : CliktCommand( help = "Export the license finding curations to a file which maps repository URLs to the license finding " + - "curations for the respective repository." + "curations for the respective repository." ) { private val licenseFindingCurationsFile by option( "--license-finding-curations-file", @@ -67,13 +67,13 @@ internal class ExportLicenseFindingCurationsCommand : CliktCommand( private val updateOnlyExisting by option( "--update-only-existing", help = "If enabled, only entries are imported for which an entry already exists which differs only in terms " + - "of its concluded license, comment or reason." + "of its concluded license, comment or reason." ).flag() private val vcsUrlMappingFile by option( "--vcs-url-mapping-file", help = "A YAML or JSON file containing a mapping of VCS URLs to other VCS URLs which will be replaced during " + - "the export." + "the export." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/repoconfig/ExportPathExcludesCommand.kt b/helper-cli/src/main/kotlin/commands/repoconfig/ExportPathExcludesCommand.kt index f74a5e975f8c..4c08eca76bce 100644 --- a/helper-cli/src/main/kotlin/commands/repoconfig/ExportPathExcludesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/repoconfig/ExportPathExcludesCommand.kt @@ -40,7 +40,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class ExportPathExcludesCommand : CliktCommand( help = "Export the path excludes to a path excludes file which maps repository URLs to the path excludes for the " + - "respective repository." + "respective repository." ) { private val pathExcludesFile by option( "--path-excludes-file", @@ -73,7 +73,7 @@ internal class ExportPathExcludesCommand : CliktCommand( private val vcsUrlMappingFile by option( "--vcs-url-mapping-file", help = "A YAML or JSON file containing a mapping of VCS URLs to other VCS URLs which will be replaced during " + - "the export." + "the export." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/repoconfig/FormatCommand.kt b/helper-cli/src/main/kotlin/commands/repoconfig/FormatCommand.kt index 2d961d9fbc34..1ef2bcfd8652 100644 --- a/helper-cli/src/main/kotlin/commands/repoconfig/FormatCommand.kt +++ b/helper-cli/src/main/kotlin/commands/repoconfig/FormatCommand.kt @@ -31,7 +31,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class FormatCommand : CliktCommand( help = "Applies the formatting used by all ort-helper commands and strips all YAML comments. The output is " + - "written to the given repository configuration file." + "written to the given repository configuration file." ) { private val repositoryConfigurationFile by argument( "repository-configuration-file", diff --git a/helper-cli/src/main/kotlin/commands/repoconfig/GenerateProjectExcludesCommand.kt b/helper-cli/src/main/kotlin/commands/repoconfig/GenerateProjectExcludesCommand.kt index 9a14f6a69311..9f346c0ee8c0 100644 --- a/helper-cli/src/main/kotlin/commands/repoconfig/GenerateProjectExcludesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/repoconfig/GenerateProjectExcludesCommand.kt @@ -37,7 +37,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class GenerateProjectExcludesCommand : CliktCommand( help = "Generates path excludes for all definition files which are not yet excluded. The output is written to " + - "the given repository configuration file." + "the given repository configuration file." ) { private val ortFile by option( "--ort-file", "-i", @@ -50,7 +50,7 @@ internal class GenerateProjectExcludesCommand : CliktCommand( private val repositoryConfigurationFile by option( "--repository-configuration-file", help = "The repository configuration file to write the result to. If the file does already exist it " + - "overrides the repository configuration contained in the given input ORT file." + "overrides the repository configuration contained in the given input ORT file." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/repoconfig/GenerateRuleViolationResolutionsCommand.kt b/helper-cli/src/main/kotlin/commands/repoconfig/GenerateRuleViolationResolutionsCommand.kt index 810724208134..ba0ffbfaf895 100644 --- a/helper-cli/src/main/kotlin/commands/repoconfig/GenerateRuleViolationResolutionsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/repoconfig/GenerateRuleViolationResolutionsCommand.kt @@ -41,7 +41,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class GenerateRuleViolationResolutionsCommand : CliktCommand( help = "Generates resolutions for all unresolved rule violations. The output is written to the given repository " + - "configuration file." + "configuration file." ) { private val ortFile by option( "--ort-file", "-i", @@ -62,7 +62,7 @@ internal class GenerateRuleViolationResolutionsCommand : CliktCommand( private val severity by option( "--severity", help = "Only consider violations of the given severities, specified as comma-separated values. Allowed " + - "values: ${Severity.entries.joinToString()}." + "values: ${Severity.entries.joinToString()}." ).enum().split(",").default(Severity.entries) override fun run() { diff --git a/helper-cli/src/main/kotlin/commands/repoconfig/GenerateScopeExcludesCommand.kt b/helper-cli/src/main/kotlin/commands/repoconfig/GenerateScopeExcludesCommand.kt index b0a9d77ebdc9..440a3a6be7f3 100644 --- a/helper-cli/src/main/kotlin/commands/repoconfig/GenerateScopeExcludesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/repoconfig/GenerateScopeExcludesCommand.kt @@ -39,7 +39,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class GenerateScopeExcludesCommand : CliktCommand( help = "Generate scope excludes based on common default for the package managers. The generated scope excludes " + - "get written to the given repository configuration file, replacing any existing scope excludes." + "get written to the given repository configuration file, replacing any existing scope excludes." ) { private val ortFile by option( "--ort-file", "-i", diff --git a/helper-cli/src/main/kotlin/commands/repoconfig/ImportLicenseFindingCurationsCommand.kt b/helper-cli/src/main/kotlin/commands/repoconfig/ImportLicenseFindingCurationsCommand.kt index 3142c90ddaa7..8d1c2eea0365 100644 --- a/helper-cli/src/main/kotlin/commands/repoconfig/ImportLicenseFindingCurationsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/repoconfig/ImportLicenseFindingCurationsCommand.kt @@ -44,7 +44,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class ImportLicenseFindingCurationsCommand : CliktCommand( help = "Import license finding curations from a license finding curations file and merge them into the given " - + "repository configuration." + + "repository configuration." ) { private val licenseFindingCurationsFile by option( "--license-finding-curations-file", @@ -73,13 +73,13 @@ internal class ImportLicenseFindingCurationsCommand : CliktCommand( private val updateOnlyExisting by option( "--update-only-existing", help = "If enabled, only entries are imported for which an entry already exists which differs only in terms " + - "of its concluded license, comment or reason." + "of its concluded license, comment or reason." ).flag() private val vcsUrlMappingFile by option( "--vcs-url-mapping-file", help = "A YAML or JSON file containing a mapping of VCS URLs to other VCS URLs which will be replaced during " + - "the import." + "the import." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/repoconfig/ImportPathExcludesCommand.kt b/helper-cli/src/main/kotlin/commands/repoconfig/ImportPathExcludesCommand.kt index 03e158f51f87..ad462c2715f5 100644 --- a/helper-cli/src/main/kotlin/commands/repoconfig/ImportPathExcludesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/repoconfig/ImportPathExcludesCommand.kt @@ -76,7 +76,7 @@ internal class ImportPathExcludesCommand : CliktCommand( private val vcsUrlMappingFile by option( "--vcs-url-mapping-file", help = "A YAML or JSON file containing a mapping of VCS URLs to other VCS URLs which will be replaced during " + - "the import." + "the import." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } diff --git a/helper-cli/src/main/kotlin/commands/repoconfig/RemoveEntriesCommand.kt b/helper-cli/src/main/kotlin/commands/repoconfig/RemoveEntriesCommand.kt index bf69a5ac6e70..24eaa3886084 100644 --- a/helper-cli/src/main/kotlin/commands/repoconfig/RemoveEntriesCommand.kt +++ b/helper-cli/src/main/kotlin/commands/repoconfig/RemoveEntriesCommand.kt @@ -44,7 +44,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class RemoveEntriesCommand : CliktCommand( help = "Removes all non-matching path and scope excludes as well as rule violation resolutions. The output is " + - "written to the given repository configuration file." + "written to the given repository configuration file." ) { private val ortFile by option( "--ort-file", "-i", @@ -57,7 +57,7 @@ internal class RemoveEntriesCommand : CliktCommand( private val repositoryConfigurationFile by option( "--repository-configuration-file", help = "The repository configuration to remove all non-matching entries from. Its initial content overrides " + - "the repository configuration contained in the given ORT result file." + "the repository configuration contained in the given ORT result file." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = true, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -66,8 +66,8 @@ internal class RemoveEntriesCommand : CliktCommand( private val sourceCodeDir by option( "--source-code-dir", help = "A directory containing the sources of the project(s) for which the configuration entries are to be " + - "removed. The provenance of these sources must match with the scan results contained in the given " + - "ORT result file." + "removed. The provenance of these sources must match with the scan results contained in the given " + + "ORT result file." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -128,10 +128,10 @@ internal class RemoveEntriesCommand : CliktCommand( val removedPathExcludes = repositoryConfiguration.excludes.paths.size - pathExcludes.size val removedScopeExcludes = repositoryConfiguration.excludes.scopes.size - scopeExcludes.size val removedLicenseFindingCurations = repositoryConfiguration.curations.licenseFindings.size - - licenseFindingCurations.size + licenseFindingCurations.size val removedIssueResolutions = repositoryConfiguration.resolutions.issues.size - issueResolutions.size val removedRuleViolationResolutions = repositoryConfiguration.resolutions.ruleViolations.size - - ruleViolationResolutions.size + ruleViolationResolutions.size appendLine("Removed entries:") appendLine() diff --git a/helper-cli/src/main/kotlin/commands/repoconfig/SortCommand.kt b/helper-cli/src/main/kotlin/commands/repoconfig/SortCommand.kt index f04ac0585d92..a913ed2b0885 100644 --- a/helper-cli/src/main/kotlin/commands/repoconfig/SortCommand.kt +++ b/helper-cli/src/main/kotlin/commands/repoconfig/SortCommand.kt @@ -32,7 +32,7 @@ import org.ossreviewtoolkit.utils.common.expandTilde internal class SortCommand : CliktCommand( help = "Sorts all exclude and curation entries of the given repository configuration alphabetically. The output " + - "is written to the given repository configuration file." + "is written to the given repository configuration file." ) { private val repositoryConfigurationFile by argument( "repository-configuration-file", diff --git a/helper-cli/src/main/kotlin/commands/scanstorage/DeleteCommand.kt b/helper-cli/src/main/kotlin/commands/scanstorage/DeleteCommand.kt index a64ecf3ab158..2e43517dfbe0 100644 --- a/helper-cli/src/main/kotlin/commands/scanstorage/DeleteCommand.kt +++ b/helper-cli/src/main/kotlin/commands/scanstorage/DeleteCommand.kt @@ -66,7 +66,7 @@ internal class DeleteCommand : CliktCommand( private val configArguments by option( "-P", help = "Override a key-value pair in the configuration file. For example: " + - "-P ort.scanner.storages.postgres.connection.schema=testSchema" + "-P ort.scanner.storages.postgres.connection.schema=testSchema" ).associate() private val sourceCodeOrigins by option( @@ -160,7 +160,7 @@ internal class DeleteCommand : CliktCommand( logger.info { "Using Postgres storage with URL '${storageConfig.connection.url}' and schema " + - "'${storageConfig.connection.schema}'." + "'${storageConfig.connection.schema}'." } val dataSource = DatabaseUtils.createHikariDataSource( diff --git a/helper-cli/src/main/kotlin/utils/Extensions.kt b/helper-cli/src/main/kotlin/utils/Extensions.kt index 56d095f3cd74..41edb14b730a 100644 --- a/helper-cli/src/main/kotlin/utils/Extensions.kt +++ b/helper-cli/src/main/kotlin/utils/Extensions.kt @@ -257,10 +257,10 @@ internal fun OrtResult.getScanIssues(omitExcluded: Boolean = false): List internal fun OrtResult.getRepositoryPathExcludes(): RepositoryPathExcludes { fun isDefinitionsFile(pathExclude: PathExclude) = PackageManager.ENABLED_BY_DEFAULT.any { - it.matchersForDefinitionFiles.any { matcher -> - pathExclude.pattern.endsWith(matcher.toString()) + it.matchersForDefinitionFiles.any { matcher -> + pathExclude.pattern.endsWith(matcher.toString()) + } } - } val pathExcludes = repository.config.excludes.paths.filterNot { isDefinitionsFile(it) } diff --git a/model/src/main/kotlin/AdvisorRecord.kt b/model/src/main/kotlin/AdvisorRecord.kt index 9c6414edbbf6..d8b522883224 100644 --- a/model/src/main/kotlin/AdvisorRecord.kt +++ b/model/src/main/kotlin/AdvisorRecord.kt @@ -60,10 +60,10 @@ data class AdvisorRecord( capability: AdvisorCapability? = null ): AdvisorResultFilter = { result -> - (capability == null || capability in result.advisor.capabilities) && result.summary.issues.any { - it.severity >= minSeverity + (capability == null || capability in result.advisor.capabilities) && result.summary.issues.any { + it.severity >= minSeverity + } } - } } @JsonIgnore diff --git a/model/src/main/kotlin/Identifier.kt b/model/src/main/kotlin/Identifier.kt index b6ae0afc5516..5ef320fcd964 100644 --- a/model/src/main/kotlin/Identifier.kt +++ b/model/src/main/kotlin/Identifier.kt @@ -89,7 +89,7 @@ data class Identifier( init { require(sanitizedComponents.none { ":" in it }) { "An identifier's properties must not contain ':' because that character is used as a separator in the " + - "string representation: type='$type', namespace='$namespace', name='$name', version='$version'." + "string representation: type='$type', namespace='$namespace', name='$name', version='$version'." } } diff --git a/model/src/main/kotlin/OrtResult.kt b/model/src/main/kotlin/OrtResult.kt index 3a07726773c3..bdb482e5778f 100644 --- a/model/src/main/kotlin/OrtResult.kt +++ b/model/src/main/kotlin/OrtResult.kt @@ -264,9 +264,9 @@ data class OrtResult( @JsonIgnore fun getOpenIssues(minSeverity: Severity = Severity.WARNING) = getIssues() - .mapNotNull { (id, issues) -> issues.takeUnless { isExcluded(id) } } - .flatten() - .filter { issue -> issue.severity >= minSeverity && getResolutions().issues.none { it.matches(issue) } } + .mapNotNull { (id, issues) -> issues.takeUnless { isExcluded(id) } } + .flatten() + .filter { issue -> issue.severity >= minSeverity && getResolutions().issues.none { it.matches(issue) } } /** * Return all projects and packages that are likely to belong to one of the organizations of the given [names]. If diff --git a/model/src/main/kotlin/PackageCuration.kt b/model/src/main/kotlin/PackageCuration.kt index 9b3ed08a1fea..93e1a30473f9 100644 --- a/model/src/main/kotlin/PackageCuration.kt +++ b/model/src/main/kotlin/PackageCuration.kt @@ -61,8 +61,8 @@ data class PackageCuration( */ private fun isApplicableDisregardingVersion(pkgId: Identifier) = id.type.equals(pkgId.type, ignoreCase = true) - && id.namespace == pkgId.namespace - && id.name.equalsOrIsBlank(pkgId.name) + && id.namespace == pkgId.namespace + && id.name.equalsOrIsBlank(pkgId.name) /** * Return true if the version of this [PackageCuration] interpreted as an Ivy version matcher is applicable to the @@ -87,7 +87,7 @@ data class PackageCuration( }.onFailure { logger.warn { "Failed to check if package curation version '${id.version}' is applicable to package version " + - "'${pkgId.version}' of package '${pkgId.toCoordinates()}'." + "'${pkgId.version}' of package '${pkgId.toCoordinates()}'." } it.showStackTrace() @@ -102,7 +102,7 @@ data class PackageCuration( */ fun isApplicable(pkgId: Identifier): Boolean = isApplicableDisregardingVersion(pkgId) - && (id.version.equalsOrIsBlank(pkgId.version) || isApplicableIvyVersion(pkgId)) + && (id.version.equalsOrIsBlank(pkgId.version) || isApplicableIvyVersion(pkgId)) /** * Apply the curation [data] to the provided [targetPackage]. @@ -112,7 +112,7 @@ data class PackageCuration( fun apply(targetPackage: CuratedPackage): CuratedPackage { require(isApplicable(targetPackage.metadata.id)) { "Package curation identifier '${id.toCoordinates()}' does not match package identifier " + - "'${targetPackage.metadata.id.toCoordinates()}'." + "'${targetPackage.metadata.id.toCoordinates()}'." } return data.apply(targetPackage) diff --git a/model/src/main/kotlin/Project.kt b/model/src/main/kotlin/Project.kt index 615e426e1db7..77a84521820f 100644 --- a/model/src/main/kotlin/Project.kt +++ b/model/src/main/kotlin/Project.kt @@ -129,7 +129,7 @@ data class Project( init { require(scopeDependencies == null || scopeNames == null) { "Not both 'scopeDependencies' and 'scopeNames' may be set, as otherwise it is ambiguous which one " + - "to use." + "to use." } } diff --git a/model/src/main/kotlin/ProvenanceResolutionResult.kt b/model/src/main/kotlin/ProvenanceResolutionResult.kt index f3ea5032ffd3..480771b74d22 100644 --- a/model/src/main/kotlin/ProvenanceResolutionResult.kt +++ b/model/src/main/kotlin/ProvenanceResolutionResult.kt @@ -67,14 +67,14 @@ data class ProvenanceResolutionResult( // TODO: Check if Git-Repo allows to include sub directories of repositories. require(vcsInfo.path.isEmpty()) { "The resolved sub-repository for package ${id.toCoordinates()} under path '$path' has a non-empty " + - "VCS path which is not allowed." + "VCS path which is not allowed." } } if (packageProvenanceResolutionIssue != null) { require(nestedProvenanceResolutionIssue == null) { "Nested provenance resolution issue is not null, even though nested provenance resolution was not " + - "executed." + "executed." } } } diff --git a/model/src/main/kotlin/ResolvedConfiguration.kt b/model/src/main/kotlin/ResolvedConfiguration.kt index 31bfa494c517..06d21d1a3a33 100644 --- a/model/src/main/kotlin/ResolvedConfiguration.kt +++ b/model/src/main/kotlin/ResolvedConfiguration.kt @@ -60,7 +60,7 @@ data class ResolvedConfiguration( val duplicateProviderIds = packageCurations.getDuplicates().map { it.provider.id } require(duplicateProviderIds.isEmpty()) { "The list 'providers' contains the following duplicates, which is not allowed: " + - "${duplicateProviderIds.joinToStringSingleQuoted()}." + "${duplicateProviderIds.joinToStringSingleQuoted()}." } } diff --git a/model/src/main/kotlin/ScanSummary.kt b/model/src/main/kotlin/ScanSummary.kt index 741d002c0fe4..44d90c50a758 100644 --- a/model/src/main/kotlin/ScanSummary.kt +++ b/model/src/main/kotlin/ScanSummary.kt @@ -116,8 +116,8 @@ data class ScanSummary( fun TextLocation.matchesPaths() = paths.any { filterPath -> - this.path.startsWith("$filterPath/") || this.path in applicableLicenseFiles - } + this.path.startsWith("$filterPath/") || this.path in applicableLicenseFiles + } return copy( licenseFindings = licenseFindings.filterTo(mutableSetOf()) { it.location.matchesPaths() }, diff --git a/model/src/main/kotlin/ScannerRun.kt b/model/src/main/kotlin/ScannerRun.kt index e0dd132ab729..e99087a11ec5 100644 --- a/model/src/main/kotlin/ScannerRun.kt +++ b/model/src/main/kotlin/ScannerRun.kt @@ -126,7 +126,7 @@ data class ScannerRun( provenances.getDuplicates { it.id }.keys.let { idsForDuplicateProvenanceResolutionResults -> require(idsForDuplicateProvenanceResolutionResults.isEmpty()) { "Found multiple provenance resolution results for the following ids: " + - "${idsForDuplicateProvenanceResolutionResults.joinToString { it.toCoordinates() }}." + "${idsForDuplicateProvenanceResolutionResults.joinToString { it.toCoordinates() }}." } } @@ -138,7 +138,7 @@ data class ScannerRun( (scannedProvenances - resolvedProvenances).let { require(it.isEmpty()) { "Found scan results which do not correspond to any resolved provenances, which is not allowed: \n" + - it.toYaml() + it.toYaml() } } @@ -146,7 +146,7 @@ data class ScannerRun( (fileListProvenances - resolvedProvenances).let { require(it.isEmpty()) { "Found a file lists which do not correspond to any resolved provenances, which is not allowed: \n" + - it.toYaml() + it.toYaml() } } @@ -263,10 +263,10 @@ data class ScannerRun( private fun scanResultForProvenanceResolutionIssues(packageProvenance: KnownProvenance?, issues: List) = ScanResult( - provenance = packageProvenance ?: UnknownProvenance, - scanner = ScannerDetails(name = "ProvenanceResolver", version = "", configuration = ""), - summary = ScanSummary.EMPTY.copy(issues = issues) -) + provenance = packageProvenance ?: UnknownProvenance, + scanner = ScannerDetails(name = "ProvenanceResolver", version = "", configuration = ""), + summary = ScanSummary.EMPTY.copy(issues = issues) + ) private fun ScanSummary.addIssue(issue: Issue?): ScanSummary = if (issue == null) this else copy(issues = (issues + issue).distinct()) diff --git a/model/src/main/kotlin/config/FileArchiverConfiguration.kt b/model/src/main/kotlin/config/FileArchiverConfiguration.kt index aa2e91a2820b..0a3978f76309 100644 --- a/model/src/main/kotlin/config/FileArchiverConfiguration.kt +++ b/model/src/main/kotlin/config/FileArchiverConfiguration.kt @@ -56,7 +56,7 @@ data class FileArchiverConfiguration( if (fileStorage != null && postgresStorage != null) { logger.warn { "'fileStorage' and 'postgresStorage' are both configured but only one storage can be used. Using " + - "'fileStorage'." + "'fileStorage'." } } } diff --git a/model/src/main/kotlin/config/FileListStorageConfiguration.kt b/model/src/main/kotlin/config/FileListStorageConfiguration.kt index 9c213a0b508e..8517008d68a7 100644 --- a/model/src/main/kotlin/config/FileListStorageConfiguration.kt +++ b/model/src/main/kotlin/config/FileListStorageConfiguration.kt @@ -49,7 +49,7 @@ data class FileListStorageConfiguration( if (fileStorage != null && postgresStorage != null) { logger.warn { "'fileStorage' and 'postgresStorage' are both configured but only one storage can be used. " + - "Using 'fileStorage'." + "Using 'fileStorage'." } } } diff --git a/model/src/main/kotlin/config/LicenseChoices.kt b/model/src/main/kotlin/config/LicenseChoices.kt index e24fe84e15a7..85ed856e14d4 100644 --- a/model/src/main/kotlin/config/LicenseChoices.kt +++ b/model/src/main/kotlin/config/LicenseChoices.kt @@ -49,7 +49,7 @@ data class LicenseChoices( val choicesWithoutGiven = repositoryLicenseChoices.filter { it.given == null } require(choicesWithoutGiven.isEmpty()) { "LicenseChoices ${choicesWithoutGiven.joinToString()} defined in $ORT_REPO_CONFIG_FILENAME are missing " + - "the 'given' expression." + "the 'given' expression." } } } diff --git a/model/src/main/kotlin/config/LicenseFindingCuration.kt b/model/src/main/kotlin/config/LicenseFindingCuration.kt index af828eb98a0c..1a40632ff8a5 100644 --- a/model/src/main/kotlin/config/LicenseFindingCuration.kt +++ b/model/src/main/kotlin/config/LicenseFindingCuration.kt @@ -94,8 +94,8 @@ class IntListToCsvStringConverter : StdConverter, String>() { class CsvStringToIntListConverter : StdConverter>() { override fun convert(value: String): List = value - .split(',') - .map { it.trim() } - .filter { it.isNotEmpty() } - .map { it.toInt() } + .split(',') + .map { it.trim() } + .filter { it.isNotEmpty() } + .map { it.toInt() } } diff --git a/model/src/main/kotlin/config/PackageConfiguration.kt b/model/src/main/kotlin/config/PackageConfiguration.kt index 6c710051d742..3a872241e637 100644 --- a/model/src/main/kotlin/config/PackageConfiguration.kt +++ b/model/src/main/kotlin/config/PackageConfiguration.kt @@ -108,7 +108,7 @@ data class VcsMatcher( fun matches(provenance: RepositoryProvenance): Boolean = type == provenance.vcsInfo.type && - // URLs need to match only after any credentials have been removed. - url.replaceCredentialsInUri() == provenance.vcsInfo.url.replaceCredentialsInUri() && - (revision == null || revision == provenance.resolvedRevision) + // URLs need to match only after any credentials have been removed. + url.replaceCredentialsInUri() == provenance.vcsInfo.url.replaceCredentialsInUri() && + (revision == null || revision == provenance.resolvedRevision) } diff --git a/model/src/main/kotlin/config/PathExclude.kt b/model/src/main/kotlin/config/PathExclude.kt index f1098a08b6c4..9ca9bfbb51f4 100644 --- a/model/src/main/kotlin/config/PathExclude.kt +++ b/model/src/main/kotlin/config/PathExclude.kt @@ -50,7 +50,7 @@ data class PathExclude( */ fun matches(path: String) = FileMatcher.match( - pattern = pattern.removePrefix("./"), - path = path - ) + pattern = pattern.removePrefix("./"), + path = path + ) } diff --git a/model/src/main/kotlin/config/ProvenanceStorageConfiguration.kt b/model/src/main/kotlin/config/ProvenanceStorageConfiguration.kt index f4219b6b6437..3b1f37033034 100644 --- a/model/src/main/kotlin/config/ProvenanceStorageConfiguration.kt +++ b/model/src/main/kotlin/config/ProvenanceStorageConfiguration.kt @@ -41,7 +41,7 @@ data class ProvenanceStorageConfiguration( if (fileStorage != null && postgresStorage != null) { logger.warn { "'fileStorage' and 'postgresStorage' are both configured but only one storage can be used. Using " + - "'fileStorage'." + "'fileStorage'." } } } diff --git a/model/src/main/kotlin/licenses/LicenseClassifications.kt b/model/src/main/kotlin/licenses/LicenseClassifications.kt index 92f8afcfe0fe..78a0d366717b 100644 --- a/model/src/main/kotlin/licenses/LicenseClassifications.kt +++ b/model/src/main/kotlin/licenses/LicenseClassifications.kt @@ -93,7 +93,7 @@ data class LicenseClassifications( val licenseIds = invalidCategorizations.keys.joinToString { it.id.toString() } val categories = invalidCategorizations.values.flatten().toSet() "Found licenses that reference non-existing categories: $licenseIds; " + - "unknown categories are $categories." + "unknown categories are $categories." } } } diff --git a/model/src/main/kotlin/licenses/LicenseInfoResolver.kt b/model/src/main/kotlin/licenses/LicenseInfoResolver.kt index 374ec3a5b2b5..f6c5045a0fce 100644 --- a/model/src/main/kotlin/licenses/LicenseInfoResolver.kt +++ b/model/src/main/kotlin/licenses/LicenseInfoResolver.kt @@ -229,7 +229,7 @@ class LicenseInfoResolver( pathExcludes = findings.pathExcludes, relativeFindingsPath = findings.relativeFindingsPath ) - } + } return resolvedLocations } diff --git a/model/src/main/kotlin/licenses/ResolvedLicenseInfo.kt b/model/src/main/kotlin/licenses/ResolvedLicenseInfo.kt index 46aadcac124c..3d41089dcde7 100644 --- a/model/src/main/kotlin/licenses/ResolvedLicenseInfo.kt +++ b/model/src/main/kotlin/licenses/ResolvedLicenseInfo.kt @@ -149,5 +149,5 @@ data class ResolvedLicenseInfo( fun List.filterExcluded() = mapNotNull { it.filterExcludedOriginalExpressions() }.filter { resolvedLicense -> resolvedLicense.sources != setOf(LicenseSource.DETECTED) || - resolvedLicense.locations.any { it.matchingPathExcludes.isEmpty() } + resolvedLicense.locations.any { it.matchingPathExcludes.isEmpty() } }.map { it.filterExcludedCopyrights() } diff --git a/model/src/main/kotlin/utils/ConfigurationResolver.kt b/model/src/main/kotlin/utils/ConfigurationResolver.kt index d34e69399598..dc8c07a81ce3 100644 --- a/model/src/main/kotlin/utils/ConfigurationResolver.kt +++ b/model/src/main/kotlin/utils/ConfigurationResolver.kt @@ -73,7 +73,7 @@ object ConfigurationResolver : Logging { if (nonApplicableCurations.isNotEmpty()) { logger.warn { "The provider '$id' returned the following non-applicable curations: " + - "${nonApplicableCurations.joinToString()}." + "${nonApplicableCurations.joinToString()}." } } diff --git a/model/src/main/kotlin/utils/DependencyGraphBuilder.kt b/model/src/main/kotlin/utils/DependencyGraphBuilder.kt index b50815fcb6e6..bc47c48cb9b1 100644 --- a/model/src/main/kotlin/utils/DependencyGraphBuilder.kt +++ b/model/src/main/kotlin/utils/DependencyGraphBuilder.kt @@ -196,7 +196,7 @@ class DependencyGraphBuilder( private fun checkReferences() { require(resolvedPackages.keys.containsAll(validPackageDependencies)) { "The following references do not actually refer to packages: " + - "${validPackageDependencies - resolvedPackages.keys}." + "${validPackageDependencies - resolvedPackages.keys}." } val packageReferencesKeysWithMultipleDistinctPackageReferences = references.groupBy { it.key }.filter { diff --git a/model/src/main/kotlin/utils/FindingCurationMatcher.kt b/model/src/main/kotlin/utils/FindingCurationMatcher.kt index 5ad401ca5823..f727b5b618e1 100644 --- a/model/src/main/kotlin/utils/FindingCurationMatcher.kt +++ b/model/src/main/kotlin/utils/FindingCurationMatcher.kt @@ -35,9 +35,9 @@ class FindingCurationMatcher { relativeFindingPath: String ): Boolean = FileMatcher.match( - pattern = curation.path, - path = finding.location.prependedPath(relativeFindingPath) - ) + pattern = curation.path, + path = finding.location.prependedPath(relativeFindingPath) + ) private fun isStartLineMatching(finding: LicenseFinding, curation: LicenseFindingCuration): Boolean = curation.startLines.isEmpty() || curation.startLines.any { it == finding.location.startLine } @@ -54,9 +54,9 @@ class FindingCurationMatcher { */ fun matches(finding: LicenseFinding, curation: LicenseFindingCuration, relativeFindingPath: String = ""): Boolean = isPathMatching(finding, curation, relativeFindingPath) && - isStartLineMatching(finding, curation) && - isLineCountMatching(finding, curation) && - isDetectedLicenseMatching(finding, curation) + isStartLineMatching(finding, curation) && + isLineCountMatching(finding, curation) && + isDetectedLicenseMatching(finding, curation) /** * Return the curated finding if the given [curation] is applicable to the given [finding] or the given [finding] diff --git a/model/src/main/kotlin/utils/JsonIncludeValueFilters.kt b/model/src/main/kotlin/utils/JsonIncludeValueFilters.kt index ec68a923e2df..bb2c72f667b2 100644 --- a/model/src/main/kotlin/utils/JsonIncludeValueFilters.kt +++ b/model/src/main/kotlin/utils/JsonIncludeValueFilters.kt @@ -54,7 +54,7 @@ internal class PackageLinkageValueFilter { internal class ResolutionsFilter { override fun equals(other: Any?): Boolean = other is Resolutions && - other.issues.isEmpty() && - other.ruleViolations.isEmpty() && - other.vulnerabilities.isEmpty() + other.issues.isEmpty() && + other.ruleViolations.isEmpty() && + other.vulnerabilities.isEmpty() } diff --git a/model/src/main/kotlin/utils/OrtResultExtensions.kt b/model/src/main/kotlin/utils/OrtResultExtensions.kt index 6d6470d78391..d3d4b36250ac 100644 --- a/model/src/main/kotlin/utils/OrtResultExtensions.kt +++ b/model/src/main/kotlin/utils/OrtResultExtensions.kt @@ -77,12 +77,12 @@ fun OrtResult.createLicenseInfoResolver( addAuthorsToCopyrights: Boolean = false, archiver: FileArchiver? = null ) = LicenseInfoResolver( - DefaultLicenseInfoProvider(this, packageConfigurationProvider), - copyrightGarbage, - addAuthorsToCopyrights, - archiver, - LicenseFilePatterns.getInstance() - ) + DefaultLicenseInfoProvider(this, packageConfigurationProvider), + copyrightGarbage, + addAuthorsToCopyrights, + archiver, + LicenseFilePatterns.getInstance() +) /** * Return the path where the repository given by [provenance] is linked into the source tree. diff --git a/model/src/main/kotlin/utils/PurlUtils.kt b/model/src/main/kotlin/utils/PurlUtils.kt index ae538ec64ee7..448b922890d0 100644 --- a/model/src/main/kotlin/utils/PurlUtils.kt +++ b/model/src/main/kotlin/utils/PurlUtils.kt @@ -111,29 +111,29 @@ internal fun createPurl( subpath: String = "" ): String = buildString { - append("pkg:") - append(type) + append("pkg:") + append(type) + + if (namespace.isNotEmpty()) { + append('/') + append(namespace.percentEncode()) + } - if (namespace.isNotEmpty()) { append('/') - append(namespace.percentEncode()) - } + append(name.percentEncode()) - append('/') - append(name.percentEncode()) + append('@') + append(version.percentEncode()) - append('@') - append(version.percentEncode()) + qualifiers.onEachIndexed { index, entry -> + if (index == 0) append("?") else append("&") + append(entry.key.percentEncode()) + append("=") + append(entry.value.percentEncode()) + } - qualifiers.onEachIndexed { index, entry -> - if (index == 0) append("?") else append("&") - append(entry.key.percentEncode()) - append("=") - append(entry.value.percentEncode()) + if (subpath.isNotEmpty()) { + val value = subpath.split('/').joinToString("/", prefix = "#") { it.percentEncode() } + append(value) + } } - - if (subpath.isNotEmpty()) { - val value = subpath.split('/').joinToString("/", prefix = "#") { it.percentEncode() } - append(value) - } -} diff --git a/model/src/main/kotlin/utils/ScanResultUtils.kt b/model/src/main/kotlin/utils/ScanResultUtils.kt index ef8b0647bd40..33f59f31e92d 100644 --- a/model/src/main/kotlin/utils/ScanResultUtils.kt +++ b/model/src/main/kotlin/utils/ScanResultUtils.kt @@ -80,8 +80,8 @@ fun mergeScanResultsByScanner( */ private fun List>.mergeAdditionalData(): Map = flatMap { it.entries } - .groupBy({ it.key }) { it.value } - .mapValues { it.value.joinToString(",") } + .groupBy({ it.key }) { it.value } + .mapValues { it.value.joinToString(",") } private fun Map>.mergeLicenseFindings(): Set { val findingsByPath = mapValues { (_, scanResults) -> diff --git a/model/src/test/kotlin/DependencyGraphTest.kt b/model/src/test/kotlin/DependencyGraphTest.kt index 02c257cb09ac..5c8ad7247c05 100644 --- a/model/src/test/kotlin/DependencyGraphTest.kt +++ b/model/src/test/kotlin/DependencyGraphTest.kt @@ -242,10 +242,10 @@ private fun id(group: String, artifact: String, version: String): Identifier = */ private fun scopeDependencies(scopes: Set, name: String): String = buildString { - scopes.find { it.name == name }?.let { scope -> - scope.dependencies.sorted().forEach { dumpDependencies(it) } + scopes.find { it.name == name }?.let { scope -> + scope.dependencies.sorted().forEach { dumpDependencies(it) } + } } -} /** * Transform a dependency tree structure starting at [ref] to a string. diff --git a/model/src/test/kotlin/HashAlgorithmTest.kt b/model/src/test/kotlin/HashAlgorithmTest.kt index 3c9426ea04f3..048aae4fdf0b 100644 --- a/model/src/test/kotlin/HashAlgorithmTest.kt +++ b/model/src/test/kotlin/HashAlgorithmTest.kt @@ -50,7 +50,7 @@ class HashAlgorithmTest : StringSpec({ "Calculating the SHA1GIT on a resource should yield the correct result" { // The expected hash was calculated with "git hash-object". HashAlgorithm.SHA1GIT.calculate("/licenses/Apache-2.0") shouldBe - "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64" + "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64" } "Calculating the SHA1GIT on non-existent field should return null" { diff --git a/model/src/test/kotlin/HashTest.kt b/model/src/test/kotlin/HashTest.kt index aa4d0a01d6ae..4635b8cc9309 100644 --- a/model/src/test/kotlin/HashTest.kt +++ b/model/src/test/kotlin/HashTest.kt @@ -59,7 +59,7 @@ class HashTest : WordSpec({ "create a SHA512 hash from a SHA-512 value" { Hash.create( "760d9348be5813285b8ad38795a2a5afe788bcddab4f7190ed581c6ea524c0d67a7dd5bdd5384f197e3b5a58c070ab5b" + - "db704493cc8e0ad63ab35f753b6d61bf" + "db704493cc8e0ad63ab35f753b6d61bf" ).algorithm shouldBe HashAlgorithm.SHA512 } diff --git a/model/src/test/kotlin/IdentifierTest.kt b/model/src/test/kotlin/IdentifierTest.kt index db38d5c2ecdc..bb3709690560 100644 --- a/model/src/test/kotlin/IdentifierTest.kt +++ b/model/src/test/kotlin/IdentifierTest.kt @@ -37,13 +37,13 @@ class IdentifierTest : WordSpec({ "be correct" { val mapping = mapOf( Identifier("manager", "namespace", "name", "version") - to "manager:namespace:name:version", + to "manager:namespace:name:version", Identifier("", "", "", "") - to ":::", + to ":::", Identifier("manager", "namespace", "name", "") - to "manager:namespace:name:", + to "manager:namespace:name:", Identifier("manager", "", "name", "version") - to "manager::name:version" + to "manager::name:version" ) mapping.entries.forAll { (identifier, stringRepresentation) -> @@ -54,13 +54,13 @@ class IdentifierTest : WordSpec({ "be parsed correctly" { val mapping = mapOf( "manager:namespace:name:version" - to Identifier("manager", "namespace", "name", "version"), + to Identifier("manager", "namespace", "name", "version"), ":::" - to Identifier("", "", "", ""), + to Identifier("", "", "", ""), "manager:namespace:name:" - to Identifier("manager", "namespace", "name", ""), + to Identifier("manager", "namespace", "name", ""), "manager::name:version" - to Identifier("manager", "", "name", "version") + to Identifier("manager", "", "name", "version") ) mapping.entries.forAll { (stringRepresentation, identifier) -> diff --git a/model/src/test/kotlin/LicenseFindingTest.kt b/model/src/test/kotlin/LicenseFindingTest.kt index 4ebafdf8ff2b..50239ebdb5f6 100644 --- a/model/src/test/kotlin/LicenseFindingTest.kt +++ b/model/src/test/kotlin/LicenseFindingTest.kt @@ -64,7 +64,7 @@ class LicenseFindingTest : WordSpec({ ) "LicenseRef-scancode-unknown-license-reference".mapLicense(mapping) shouldBe - "LicenseRef-scancode-unknown-license-reference" + "LicenseRef-scancode-unknown-license-reference" } "apply the license mapping to non-parsable SPDX licenses" { @@ -84,13 +84,13 @@ class LicenseFindingTest : WordSpec({ "(example) test license OR " + "test (example) license OR " + "test license (example)" - ).mapLicense(mapping) shouldBe - "LicenseRef-scancode-proprietary-license OR " + - "LicenseRef-scancode-proprietary-license OR " + - "LicenseRef-scancode-proprietary-license OR " + - "LicenseRef-scancode-proprietary-license OR " + - "LicenseRef-scancode-proprietary-license OR " + - "LicenseRef-scancode-proprietary-license" + ).mapLicense(mapping) shouldBe + "LicenseRef-scancode-proprietary-license OR " + + "LicenseRef-scancode-proprietary-license OR " + + "LicenseRef-scancode-proprietary-license OR " + + "LicenseRef-scancode-proprietary-license OR " + + "LicenseRef-scancode-proprietary-license OR " + + "LicenseRef-scancode-proprietary-license" } "apply the license mapping to complex SPDX expressions" { @@ -99,7 +99,7 @@ class LicenseFindingTest : WordSpec({ ) "(AGPL-1.0-or-later AND BSD (3-Clause)) OR MIT".mapLicense(mapping) shouldBe - "(AGPL-1.0-or-later AND BSD-3-Clause) OR MIT" + "(AGPL-1.0-or-later AND BSD-3-Clause) OR MIT" } "apply the license mapping without removing necessary parentheses" { @@ -117,7 +117,7 @@ class LicenseFindingTest : WordSpec({ ) "AGPL-1.0-or-later OR BSD (3-Clause) OR BSD (2-Clause)".mapLicense(mapping) shouldBe - "AGPL-1.0-or-later OR BSD-3-Clause OR BSD-2-Clause" + "AGPL-1.0-or-later OR BSD-3-Clause OR BSD-2-Clause" } "properly replace the same license multiple times" { diff --git a/model/src/test/kotlin/OrtResultTest.kt b/model/src/test/kotlin/OrtResultTest.kt index f6cf3605d72a..3f3fdaf1e478 100644 --- a/model/src/test/kotlin/OrtResultTest.kt +++ b/model/src/test/kotlin/OrtResultTest.kt @@ -167,10 +167,10 @@ class OrtResultTest : WordSpec({ packages = emptySet(), issues = mapOf( Identifier("Maven:org.oss-review-toolkit:example:1.0") to - listOf( - Issue(message = "Issue message to resolve", source = ""), - Issue(message = "Non-resolved issue", source = "") - ) + listOf( + Issue(message = "Issue message to resolve", source = ""), + Issue(message = "Non-resolved issue", source = "") + ) ) ) ) @@ -192,18 +192,18 @@ class OrtResultTest : WordSpec({ packages = emptySet(), issues = mapOf( Identifier("Maven:org.oss-review-toolkit:example:1.0") to - listOf( - Issue( - message = "Issue with severity 'warning'", - source = "", - severity = Severity.WARNING - ), - Issue( - message = "Issue with severity 'hint'.", - source = "", - severity = Severity.HINT - ) + listOf( + Issue( + message = "Issue with severity 'warning'", + source = "", + severity = Severity.WARNING + ), + Issue( + message = "Issue with severity 'hint'.", + source = "", + severity = Severity.HINT ) + ) ) ) ) @@ -243,9 +243,9 @@ class OrtResultTest : WordSpec({ packages = emptySet(), issues = mapOf( Identifier("Maven:org.oss-review-toolkit:excluded:1.0") to - listOf(Issue(message = "Excluded issue", source = "")), + listOf(Issue(message = "Excluded issue", source = "")), Identifier("Maven:org.oss-review-toolkit:included:1.0") to - listOf(Issue(message = "Included issue", source = "")) + listOf(Issue(message = "Included issue", source = "")) ) ) ) diff --git a/model/src/test/kotlin/PackageCurationTest.kt b/model/src/test/kotlin/PackageCurationTest.kt index f1c3c23dfab5..8edc4142727d 100644 --- a/model/src/test/kotlin/PackageCurationTest.kt +++ b/model/src/test/kotlin/PackageCurationTest.kt @@ -395,11 +395,11 @@ class PackageCurationTest : WordSpec({ val result3 = curation3.apply(result2) result1.metadata.declaredLicensesProcessed.spdxExpression shouldBe - "Apache-2.0 AND BSD-3-Clause".toSpdx() + "Apache-2.0 AND BSD-3-Clause".toSpdx() result2.metadata.declaredLicensesProcessed.spdxExpression shouldBe - "Apache-2.0 AND BSD-3-Clause AND CC-BY-1.0".toSpdx() + "Apache-2.0 AND BSD-3-Clause AND CC-BY-1.0".toSpdx() result3.metadata.declaredLicensesProcessed.spdxExpression shouldBe - "Apache-2.0 AND BSD-3-Clause AND CC-BY-2.0".toSpdx() + "Apache-2.0 AND BSD-3-Clause AND CC-BY-2.0".toSpdx() result3.curations[0].base.declaredLicenseMapping should beEmpty() result3.curations[1].base.declaredLicenseMapping should beEmpty() diff --git a/model/src/test/kotlin/config/HttpFileStorageConfigurationTest.kt b/model/src/test/kotlin/config/HttpFileStorageConfigurationTest.kt index 44ded6722255..6133dfad1ae1 100644 --- a/model/src/test/kotlin/config/HttpFileStorageConfigurationTest.kt +++ b/model/src/test/kotlin/config/HttpFileStorageConfigurationTest.kt @@ -34,7 +34,7 @@ class HttpFileStorageConfigurationTest : StringSpec({ headers: key1: "***" key2: "***" - """.trimIndent() + """.trimIndent() } "Query string should be masked in serialization" { @@ -44,6 +44,6 @@ class HttpFileStorageConfigurationTest : StringSpec({ --- url: "url" query: "***" - """.trimIndent() + """.trimIndent() } }) diff --git a/model/src/test/kotlin/config/IssueResolutionTest.kt b/model/src/test/kotlin/config/IssueResolutionTest.kt index c321a2f922b0..139ed52707b6 100644 --- a/model/src/test/kotlin/config/IssueResolutionTest.kt +++ b/model/src/test/kotlin/config/IssueResolutionTest.kt @@ -56,10 +56,10 @@ class IssueResolutionTest : WordSpec({ private fun resolution(message: String) = IssueResolution( - message = message, - reason = IssueResolutionReason.CANT_FIX_ISSUE, - comment = "" -) + message = message, + reason = IssueResolutionReason.CANT_FIX_ISSUE, + comment = "" + ) private fun issue(message: String) = Issue( diff --git a/model/src/test/kotlin/config/LicenseFindingCurationTest.kt b/model/src/test/kotlin/config/LicenseFindingCurationTest.kt index 883b787d987d..274a704f43cb 100644 --- a/model/src/test/kotlin/config/LicenseFindingCurationTest.kt +++ b/model/src/test/kotlin/config/LicenseFindingCurationTest.kt @@ -35,7 +35,7 @@ class LicenseFindingCurationTest : WordSpec({ detected_license: "MIT" reason: "INCORRECT" concluded_license: "Apache-2.0" - """.trimIndent() + """.trimIndent() val curation = yaml.fromYaml().toYaml().fromYaml() diff --git a/model/src/test/kotlin/config/OrtConfigurationTest.kt b/model/src/test/kotlin/config/OrtConfigurationTest.kt index bb608d8ded0e..c9478f1b35e2 100644 --- a/model/src/test/kotlin/config/OrtConfigurationTest.kt +++ b/model/src/test/kotlin/config/OrtConfigurationTest.kt @@ -236,7 +236,7 @@ class OrtConfigurationTest : WordSpec({ get("FossId") shouldNotBeNull { val urlMapping = "https://my-repo.example.org(?.*) -> " + - "ssh://my-mapped-repo.example.org\${repoPath}" + "ssh://my-mapped-repo.example.org\${repoPath}" this shouldContainExactly mapOf( "serverUrl" to "https://fossid.example.com/instance/", diff --git a/model/src/test/kotlin/config/RepositoryConfigurationTest.kt b/model/src/test/kotlin/config/RepositoryConfigurationTest.kt index 2f835d4c49ce..1465c21f5b51 100644 --- a/model/src/test/kotlin/config/RepositoryConfigurationTest.kt +++ b/model/src/test/kotlin/config/RepositoryConfigurationTest.kt @@ -43,7 +43,7 @@ class RepositoryConfigurationTest : WordSpec({ - pattern: "android/**/build.gradle" reason: "BUILD_TOOL_OF" comment: "project comment" - """.trimIndent() + """.trimIndent() val config = configuration.fromYaml() @@ -121,7 +121,7 @@ class RepositoryConfigurationTest : WordSpec({ - given: MPL-2.0 or EPL-1.0 choice: MPL-2.0 - choice: MPL-2.0 AND MIT - """.trimIndent() + """.trimIndent() val repositoryConfiguration = configuration.fromYaml() diff --git a/model/src/test/kotlin/config/RuleViolationResolutionTest.kt b/model/src/test/kotlin/config/RuleViolationResolutionTest.kt index bfe2ae7ea103..75dc12862329 100644 --- a/model/src/test/kotlin/config/RuleViolationResolutionTest.kt +++ b/model/src/test/kotlin/config/RuleViolationResolutionTest.kt @@ -38,7 +38,7 @@ class RuleViolationResolutionTest : WordSpec({ } "ignore white spaces" { - resolution("Message with additional spaces. Another line.").matches( + resolution("Message with additional spaces. Another line.").matches( ruleViolation( """ Message with additional spaces. @@ -56,10 +56,10 @@ class RuleViolationResolutionTest : WordSpec({ private fun resolution(message: String) = RuleViolationResolution( - message = message, - reason = RuleViolationResolutionReason.EXAMPLE_OF_EXCEPTION, - comment = "" -) + message = message, + reason = RuleViolationResolutionReason.EXAMPLE_OF_EXCEPTION, + comment = "" + ) private fun ruleViolation(message: String) = RuleViolation( diff --git a/model/src/test/kotlin/config/VulnerabilityResolutionTest.kt b/model/src/test/kotlin/config/VulnerabilityResolutionTest.kt index 0032626a5bd3..f4529ebe7880 100644 --- a/model/src/test/kotlin/config/VulnerabilityResolutionTest.kt +++ b/model/src/test/kotlin/config/VulnerabilityResolutionTest.kt @@ -40,9 +40,9 @@ class VulnerabilityResolutionTest : WordSpec({ private fun resolution(id: String) = VulnerabilityResolution( - id = id, - reason = VulnerabilityResolutionReason.CANT_FIX_VULNERABILITY, - comment = "" -) + id = id, + reason = VulnerabilityResolutionReason.CANT_FIX_VULNERABILITY, + comment = "" + ) private fun vulnerability(id: String) = Vulnerability(id = id, references = emptyList()) diff --git a/model/src/test/kotlin/licenses/LicenseInfoResolverTest.kt b/model/src/test/kotlin/licenses/LicenseInfoResolverTest.kt index 264a3302c9b9..26cf86c13c05 100644 --- a/model/src/test/kotlin/licenses/LicenseInfoResolverTest.kt +++ b/model/src/test/kotlin/licenses/LicenseInfoResolverTest.kt @@ -674,21 +674,21 @@ private fun createLicenseInfo( detectedLicenses: List = emptyList(), concludedLicense: SpdxExpression? = null ) = LicenseInfo( - id = id, - declaredLicenseInfo = DeclaredLicenseInfo( - authors = authors, - licenses = declaredLicenses, - processed = DeclaredLicenseProcessor.process(declaredLicenses), - appliedCurations = emptyList() - ), - detectedLicenseInfo = DetectedLicenseInfo( - findings = detectedLicenses - ), - concludedLicenseInfo = ConcludedLicenseInfo( - concludedLicense = concludedLicense, - appliedCurations = emptyList() - ) + id = id, + declaredLicenseInfo = DeclaredLicenseInfo( + authors = authors, + licenses = declaredLicenses, + processed = DeclaredLicenseProcessor.process(declaredLicenses), + appliedCurations = emptyList() + ), + detectedLicenseInfo = DetectedLicenseInfo( + findings = detectedLicenses + ), + concludedLicenseInfo = ConcludedLicenseInfo( + concludedLicense = concludedLicense, + appliedCurations = emptyList() ) +) private class SimpleLicenseInfoProvider(licenseInfo: List) : LicenseInfoProvider { private val licenseInfoById = licenseInfo.associateBy { it.id } @@ -815,17 +815,17 @@ private fun ResolvedLicenseInfo.pathExcludesForLicense( provenance: Provenance, location: TextLocation ) = find { it.license == SpdxSingleLicenseExpression.parse(license) } - ?.locations - ?.find { it.provenance == provenance && it.location == location } - ?.matchingPathExcludes - ?.toSet().orEmpty() + ?.locations + ?.find { it.provenance == provenance && it.location == location } + ?.matchingPathExcludes + ?.toSet().orEmpty() private fun ResolvedLicenseInfo.pathExcludesForCopyright( copyright: String, provenance: Provenance, location: TextLocation ) = flatMap { license -> license.locations.filter { it.provenance == provenance } } - .flatMap { it.copyrights } - .find { it.statement == copyright && it.location == location } - ?.matchingPathExcludes - ?.toSet().orEmpty() + .flatMap { it.copyrights } + .find { it.statement == copyright && it.location == location } + ?.matchingPathExcludes + ?.toSet().orEmpty() diff --git a/model/src/test/kotlin/licenses/LicenseViewTest.kt b/model/src/test/kotlin/licenses/LicenseViewTest.kt index 416f0190d8a3..d5e8fe40cb06 100644 --- a/model/src/test/kotlin/licenses/LicenseViewTest.kt +++ b/model/src/test/kotlin/licenses/LicenseViewTest.kt @@ -67,56 +67,56 @@ class LicenseViewTest : WordSpec() { view.getLicensesWithSources(packageWithoutLicense) should beEmpty() view.getLicensesWithSources(packageWithConcludedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithDeclaredLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED + ) view.getLicensesWithSources(packageWithDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED, - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED, + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED + ) view.getLicensesWithSources(packageWithConcludedAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED, - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED, + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED, - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED, + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED, - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED, - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED, + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED, + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) } } @@ -127,48 +127,48 @@ class LicenseViewTest : WordSpec() { view.getLicensesWithSources(packageWithoutLicense) should beEmpty() view.getLicensesWithSources(packageWithConcludedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithDeclaredLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED + ) view.getLicensesWithSources(packageWithDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithConcludedAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED, - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED, + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) } } @@ -179,46 +179,46 @@ class LicenseViewTest : WordSpec() { view.getLicensesWithSources(packageWithoutLicense) should beEmpty() view.getLicensesWithSources(packageWithConcludedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithDeclaredLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED + ) view.getLicensesWithSources(packageWithDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithConcludedAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) } } @@ -229,42 +229,42 @@ class LicenseViewTest : WordSpec() { view.getLicensesWithSources(packageWithoutLicense) should beEmpty() view.getLicensesWithSources(packageWithConcludedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithDeclaredLicense) should beEmpty() view.getLicensesWithSources(packageWithDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithConcludedAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) } } @@ -275,34 +275,34 @@ class LicenseViewTest : WordSpec() { view.getLicensesWithSources(packageWithoutLicense) should beEmpty() view.getLicensesWithSources(packageWithConcludedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithDeclaredLicense) should beEmpty() view.getLicensesWithSources(packageWithDetectedLicense) should beEmpty() view.getLicensesWithSources(packageWithConcludedAndDeclaredLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithConcludedAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) view.getLicensesWithSources(packageWithDeclaredAndDetectedLicense) should beEmpty() view.getLicensesWithSources(packageWithConcludedAndDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.CONCLUDED, - "LicenseRef-b" to LicenseSource.CONCLUDED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.CONCLUDED, + "LicenseRef-b" to LicenseSource.CONCLUDED + ) } } @@ -315,32 +315,32 @@ class LicenseViewTest : WordSpec() { view.getLicensesWithSources(packageWithConcludedLicense) should beEmpty() view.getLicensesWithSources(packageWithDeclaredLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED + ) view.getLicensesWithSources(packageWithDetectedLicense) should beEmpty() view.getLicensesWithSources(packageWithConcludedAndDeclaredLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED + ) view.getLicensesWithSources(packageWithConcludedAndDetectedLicense) should beEmpty() view.getLicensesWithSources(packageWithDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DECLARED, - "LicenseRef-b" to LicenseSource.DECLARED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DECLARED, + "LicenseRef-b" to LicenseSource.DECLARED + ) } } @@ -355,30 +355,30 @@ class LicenseViewTest : WordSpec() { view.getLicensesWithSources(packageWithDeclaredLicense) should beEmpty() view.getLicensesWithSources(packageWithDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredLicense) should beEmpty() view.getLicensesWithSources(packageWithConcludedAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) view.getLicensesWithSources(packageWithConcludedAndDeclaredAndDetectedLicense) should - containLicensesWithSources( - "LicenseRef-a" to LicenseSource.DETECTED, - "LicenseRef-b" to LicenseSource.DETECTED - ) + containLicensesWithSources( + "LicenseRef-a" to LicenseSource.DETECTED, + "LicenseRef-b" to LicenseSource.DETECTED + ) } } } diff --git a/model/src/test/kotlin/utils/DependencyGraphBuilderTest.kt b/model/src/test/kotlin/utils/DependencyGraphBuilderTest.kt index 7738dfa887c3..114490da5031 100644 --- a/model/src/test/kotlin/utils/DependencyGraphBuilderTest.kt +++ b/model/src/test/kotlin/utils/DependencyGraphBuilderTest.kt @@ -383,9 +383,9 @@ private fun createDependency( version: String, dependencies: Set = emptySet() ) = PackageReference( - id = Identifier("test", group, artifact, version), - dependencies = dependencies - ) + id = Identifier("test", group, artifact, version), + dependencies = dependencies +) /** * Return the package references from the given [scopes] associated with the scope with the given [scopeName]. diff --git a/model/src/test/kotlin/utils/ExtensionsTest.kt b/model/src/test/kotlin/utils/ExtensionsTest.kt index 333d73c15fa7..e87d1b3cc99f 100644 --- a/model/src/test/kotlin/utils/ExtensionsTest.kt +++ b/model/src/test/kotlin/utils/ExtensionsTest.kt @@ -27,7 +27,7 @@ class ExtensionsTest : WordSpec({ "return the manifest path" { "https://example.com/repo.git?manifest=default.xml".parseRepoManifestPath() shouldBe "default.xml" "https://example.com/repo.git?other=param&manifest=default.xml".parseRepoManifestPath() shouldBe - "default.xml" + "default.xml" } "return null if no manifest is found" { diff --git a/notifier/src/main/kotlin/modules/JiraNotifier.kt b/notifier/src/main/kotlin/modules/JiraNotifier.kt index 0f9880cde625..3f3911783225 100644 --- a/notifier/src/main/kotlin/modules/JiraNotifier.kt +++ b/notifier/src/main/kotlin/modules/JiraNotifier.kt @@ -80,7 +80,7 @@ class JiraNotifier(private val restClient: JiraRestClient) { }.onFailure { logger.error { "The transition to state '$state' for the issue '$issueKey' is not possible: " + - it.collectMessages() + it.collectMessages() } }.isSuccess } @@ -127,7 +127,7 @@ class JiraNotifier(private val restClient: JiraRestClient) { return Result.failure( IllegalArgumentException( "The issue type '$issueType' is not valid. Use a valid issue type as specified in your " + - "project '$projectKey'." + "project '$projectKey'." ) ) } @@ -166,7 +166,7 @@ class JiraNotifier(private val restClient: JiraRestClient) { }.map { issue }.onFailure { logger.error { "The comment for the issue '${issue.key} could not be added: " + - it.collectMessages() + it.collectMessages() } } } else if (searchResult.total > 1) { @@ -187,7 +187,7 @@ class JiraNotifier(private val restClient: JiraRestClient) { }.onFailure { logger.error { "The issue for the project '$projectKey' could not be created: " + - it.collectMessages() + it.collectMessages() } } } diff --git a/plugins/commands/advisor/src/main/kotlin/AdvisorCommand.kt b/plugins/commands/advisor/src/main/kotlin/AdvisorCommand.kt index 859e0105b8c5..4abdfd811d92 100644 --- a/plugins/commands/advisor/src/main/kotlin/AdvisorCommand.kt +++ b/plugins/commands/advisor/src/main/kotlin/AdvisorCommand.kt @@ -86,7 +86,7 @@ class AdvisorCommand : OrtCommand( private val labels by option( "--label", "-l", help = "Set a label in the ORT result, overwriting any existing label of the same name. Can be used multiple " + - "times. For example: --label distribution=external" + "times. For example: --label distribution=external" ).associate() private val resolutionsFile by option( @@ -150,7 +150,7 @@ class AdvisorCommand : OrtCommand( println( "$vulnerablePackageCount of $totalPackageCount package(s) (not counting excluded ones) are " + - "vulnerable, with $vulnerabilityCount vulnerabilities in total." + "vulnerable, with $vulnerabilityCount vulnerabilities in total." ) } diff --git a/plugins/commands/analyzer/src/main/kotlin/AnalyzerCommand.kt b/plugins/commands/analyzer/src/main/kotlin/AnalyzerCommand.kt index 02de6c14ea9d..500a10f81332 100644 --- a/plugins/commands/analyzer/src/main/kotlin/AnalyzerCommand.kt +++ b/plugins/commands/analyzer/src/main/kotlin/AnalyzerCommand.kt @@ -69,7 +69,7 @@ class AnalyzerCommand : OrtCommand( private val inputDir by option( "--input-dir", "-i", help = "The project directory to analyze. As a special case, if only one package manager is enabled, this " + - "may point to a definition file for that package manager to only analyze that single project." + "may point to a definition file for that package manager to only analyze that single project." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = true, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -93,7 +93,7 @@ class AnalyzerCommand : OrtCommand( private val repositoryConfigurationFile by option( "--repository-configuration-file", help = "A file containing the repository configuration. If set, overrides any repository configuration " + - "contained in a '$ORT_REPO_CONFIG_FILENAME' file in the repository." + "contained in a '$ORT_REPO_CONFIG_FILENAME' file in the repository." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -112,7 +112,7 @@ class AnalyzerCommand : OrtCommand( private val labels by option( "--label", "-l", help = "Set a label in the ORT result, overwriting any existing label of the same name. Can be used multiple " + - "times. For example: --label distribution=external" + "times. For example: --label distribution=external" ).associate() private val dryRun by option( @@ -160,7 +160,7 @@ class AnalyzerCommand : OrtCommand( } else if (repositoryPackageCurations.isNotEmpty()) { logger.warn { "Existing package curations from '${repositoryConfigurationFile.absolutePath}' are not applied " + - "because the feature is disabled." + "because the feature is disabled." } } diff --git a/plugins/commands/api/src/main/kotlin/OrtCommand.kt b/plugins/commands/api/src/main/kotlin/OrtCommand.kt index 26f8500e2b6d..750f8c0d203a 100644 --- a/plugins/commands/api/src/main/kotlin/OrtCommand.kt +++ b/plugins/commands/api/src/main/kotlin/OrtCommand.kt @@ -54,7 +54,7 @@ abstract class OrtCommand(name: String, help: String) : CliktCommand(name = name if (existingOutputFiles.isNotEmpty()) { throw UsageError( message = "None of the output files $existingOutputFiles must exist yet. To overwrite output files " + - "set the 'forceOverwrite' option in '$ORT_CONFIG_FILENAME'.", + "set the 'forceOverwrite' option in '$ORT_CONFIG_FILENAME'.", statusCode = 2 ) } diff --git a/plugins/commands/api/src/main/kotlin/utils/SeverityStats.kt b/plugins/commands/api/src/main/kotlin/utils/SeverityStats.kt index d6c0a7c3c852..b69e740eb510 100644 --- a/plugins/commands/api/src/main/kotlin/utils/SeverityStats.kt +++ b/plugins/commands/api/src/main/kotlin/utils/SeverityStats.kt @@ -51,9 +51,9 @@ sealed class SeverityStats( resolvedRuleViolations: Collection, unresolvedRuleViolations: Collection ) = RuleViolationsSeverityStats( - resolvedCounts = resolvedRuleViolations.groupingBy { it.severity }.eachCount(), - unresolvedCounts = unresolvedRuleViolations.groupingBy { it.severity }.eachCount() - ) + resolvedCounts = resolvedRuleViolations.groupingBy { it.severity }.eachCount(), + unresolvedCounts = unresolvedRuleViolations.groupingBy { it.severity }.eachCount() + ) } /** @@ -109,7 +109,7 @@ sealed class SeverityStats( println( "There $be $severeCount unresolved $thing with a severity equal to or greater than the $threshold " + - "threshold." + "threshold." ) throw ProgramResult(severeStatusCode) diff --git a/plugins/commands/compare/src/main/kotlin/CompareCommand.kt b/plugins/commands/compare/src/main/kotlin/CompareCommand.kt index 84c5dd1c50b2..357af87078f4 100644 --- a/plugins/commands/compare/src/main/kotlin/CompareCommand.kt +++ b/plugins/commands/compare/src/main/kotlin/CompareCommand.kt @@ -62,7 +62,7 @@ class CompareCommand : OrtCommand( private val method by option( "--method", "-m", help = "The method to use when comparing ORT results. Must be one of " + - "${CompareMethod.entries.map { it.name }}." + "${CompareMethod.entries.map { it.name }}." ).enum() .default(CompareMethod.TEXT_DIFF) @@ -166,5 +166,5 @@ private class InvariantEnvironmentSerializer : StdSerializer(Enviro private fun Map.replaceIn(text: String) = entries.fold(text) { currentText, (from, to) -> - currentText.replace(from, to) -} + currentText.replace(from, to) + } diff --git a/plugins/commands/config/src/main/kotlin/ConfigCommand.kt b/plugins/commands/config/src/main/kotlin/ConfigCommand.kt index 92896fc6b3dc..950585c70b60 100644 --- a/plugins/commands/config/src/main/kotlin/ConfigCommand.kt +++ b/plugins/commands/config/src/main/kotlin/ConfigCommand.kt @@ -52,7 +52,7 @@ class ConfigCommand : OrtCommand( private val showReference by option( "--show-reference", help = "Show the reference configuration. This configuration is never actually used as it just contains " + - "example entries for all supported configuration options." + "example entries for all supported configuration options." ).flag() private val checkSyntax by option( diff --git a/plugins/commands/downloader/src/main/kotlin/DownloaderCommand.kt b/plugins/commands/downloader/src/main/kotlin/DownloaderCommand.kt index 101eba5076dc..67da37193a8e 100644 --- a/plugins/commands/downloader/src/main/kotlin/DownloaderCommand.kt +++ b/plugins/commands/downloader/src/main/kotlin/DownloaderCommand.kt @@ -106,32 +106,32 @@ class DownloaderCommand : OrtCommand( private val projectNameOption by option( "--project-name", help = "The speaking name of the project to download. For use together with '--project-url'. Ignored if " + - "'--ort-file' is also specified. (default: the last part of the project URL)" + "'--ort-file' is also specified. (default: the last part of the project URL)" ).inputGroup() private val vcsTypeOption by option( "--vcs-type", help = "The VCS type if '--project-url' points to a VCS. Ignored if '--ort-file' is also specified. " + - "(default: the VCS type detected by querying the project URL)" + "(default: the VCS type detected by querying the project URL)" ).inputGroup() private val vcsRevisionOption by option( "--vcs-revision", help = "The VCS revision if '--project-url' points to a VCS. Ignored if '--ort-file' is also specified. " + - "(default: the VCS's default revision)" + "(default: the VCS's default revision)" ).inputGroup() private val vcsPath by option( "--vcs-path", help = "The VCS path if '--project-url' points to a VCS. Ignored if '--ort-file' is also specified. " + - "(default: the empty root path)" + "(default: the empty root path)" ).default("").inputGroup() private val licenseClassificationsFile by option( "--license-classifications-file", help = "A file containing the license classifications that are used to limit downloads if the included " + - "categories are specified in the '$ORT_CONFIG_FILENAME' file. If not specified, all packages are " + - "downloaded." + "categories are specified in the '$ORT_CONFIG_FILENAME' file. If not specified, all packages are " + + "downloaded." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -170,11 +170,11 @@ class DownloaderCommand : OrtCommand( private val archiveMode by mutuallyExclusiveOptions( option( help = "Archive the downloaded source code as ZIP files to the output directory. Is ignored if " + - "'--project-url' is also specified." + "'--project-url' is also specified." ).switch("--archive" to ArchiveMode.ENTITY), option( help = "Archive all the downloaded source code as a single ZIP file to the output directory. Is ignored " + - "if '--project-url' is also specified." + "if '--project-url' is also specified." ).switch("--archive-all" to ArchiveMode.BUNDLE) ).single().default(ArchiveMode.NONE) @@ -186,7 +186,7 @@ class DownloaderCommand : OrtCommand( private val packageIds by option( "--package-ids", help = "A comma-separated list of regular expressions for matching package ids from the ORT file's analyzer " + - "result to limit downloads to. If not specified, all packages are downloaded." + "result to limit downloads to. If not specified, all packages are downloaded." ).split(",") private val skipExcluded by option( @@ -227,7 +227,7 @@ class DownloaderCommand : OrtCommand( if (ortResult.analyzer?.result == null) { logger.warn { "Cannot run the downloader as the provided ORT result file '${ortFile.canonicalPath}' does " + - "not contain an analyzer result. Nothing will be downloaded." + "not contain an analyzer result. Nothing will be downloaded." } throw ProgramResult(0) @@ -235,7 +235,7 @@ class DownloaderCommand : OrtCommand( println( "Downloading ${packageTypes.joinToString(" and ") { "${it}s" }} from ORT result file at " + - "'${ortFile.canonicalPath}'..." + "'${ortFile.canonicalPath}'..." ) val packages = mutableListOf().apply { diff --git a/plugins/commands/evaluator/src/main/kotlin/EvaluatorCommand.kt b/plugins/commands/evaluator/src/main/kotlin/EvaluatorCommand.kt index f0c5d3bbfe77..6d9b38f4b4bb 100644 --- a/plugins/commands/evaluator/src/main/kotlin/EvaluatorCommand.kt +++ b/plugins/commands/evaluator/src/main/kotlin/EvaluatorCommand.kt @@ -98,7 +98,7 @@ class EvaluatorCommand : OrtCommand( private val outputDir by option( "--output-dir", "-o", help = "The directory to write the ORT result file with evaluation results to. If no output directory is " + - "specified, no ORT result file is written and only the exit code signals a success or failure." + "specified, no ORT result file is written and only the exit code signals a success or failure." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } @@ -143,7 +143,7 @@ class EvaluatorCommand : OrtCommand( private val packageConfigurationsDir by option( "--package-configurations-dir", help = "A directory that is searched recursively for package configuration files. Each file must only " + - "contain a single package configuration." + "contain a single package configuration." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -152,8 +152,8 @@ class EvaluatorCommand : OrtCommand( private val packageCurationsFile by option( "--package-curations-file", help = "A file containing package curations. This replaces all package curations contained in the given ORT " + - "result file with the ones present in the given file and, if enabled, those from the package " + - "configuration." + "result file with the ones present in the given file and, if enabled, those from the package " + + "configuration." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -162,8 +162,8 @@ class EvaluatorCommand : OrtCommand( private val packageCurationsDir by option( "--package-curations-dir", help = "A directory containing package curation files. This replaces all package curations contained in the " + - "given ORT result file with the ones present in the given directory and, if enabled, those from the " + - "package configuration file." + "given ORT result file with the ones present in the given directory and, if enabled, those from the " + + "package configuration file." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -172,7 +172,7 @@ class EvaluatorCommand : OrtCommand( private val repositoryConfigurationFile by option( "--repository-configuration-file", help = "A file containing the repository configuration. If set, overrides the repository configuration " + - "contained in the ORT result input file." + "contained in the ORT result input file." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -190,7 +190,7 @@ class EvaluatorCommand : OrtCommand( private val labels by option( "--label", "-l", help = "Set a label in the ORT result, overwriting any existing label of the same name. Can be used multiple " + - "times. For example: --label distribution=external" + "times. For example: --label distribution=external" ).associate() private val checkSyntax by option( @@ -209,10 +209,10 @@ class EvaluatorCommand : OrtCommand( } val configurationFiles = listOfNotNull( - copyrightGarbageFile, - licenseClassificationsFile, - packageCurationsFile, - repositoryConfigurationFile + copyrightGarbageFile, + licenseClassificationsFile, + packageCurationsFile, + repositoryConfigurationFile ) val configurationInfo = configurationFiles.joinToString("\n\t") { file -> diff --git a/plugins/commands/notifier/src/main/kotlin/NotifierCommand.kt b/plugins/commands/notifier/src/main/kotlin/NotifierCommand.kt index 5bdb7039bc2c..a0c22a6e3ed7 100644 --- a/plugins/commands/notifier/src/main/kotlin/NotifierCommand.kt +++ b/plugins/commands/notifier/src/main/kotlin/NotifierCommand.kt @@ -76,7 +76,7 @@ class NotifierCommand : OrtCommand( private val labels by option( "--label", "-l", help = "Set a label in the ORT result passed to the notifier script, overwriting any existing label of the " + - "same name. Can be used multiple times. For example: --label distribution=external" + "same name. Can be used multiple times. For example: --label distribution=external" ).associate() override fun run() { @@ -97,7 +97,7 @@ class NotifierCommand : OrtCommand( if (!notificationsFile.isFile) { throw UsageError( "No notifications file option specified and no default notifications file found at " + - "'$notificationsFile'." + "'$notificationsFile'." ) } diff --git a/plugins/commands/reporter/src/main/kotlin/ReporterCommand.kt b/plugins/commands/reporter/src/main/kotlin/ReporterCommand.kt index a6270c3376ef..738b35465175 100644 --- a/plugins/commands/reporter/src/main/kotlin/ReporterCommand.kt +++ b/plugins/commands/reporter/src/main/kotlin/ReporterCommand.kt @@ -109,7 +109,7 @@ class ReporterCommand : OrtCommand( private val copyrightGarbageFile by option( "--copyright-garbage-file", help = "A file containing copyright statements which are marked as garbage. This can make the output " + - "inconsistent with the evaluator output but is useful when testing copyright garbage." + "inconsistent with the evaluator output but is useful when testing copyright garbage." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -119,8 +119,8 @@ class ReporterCommand : OrtCommand( private val customLicenseTextsDir by option( "--custom-license-texts-dir", help = "A directory which maps custom license IDs to license texts. It should contain one text file per " + - "license with the license ID as the filename. A custom license text is used only if its ID has a " + - "'LicenseRef-' prefix and if the respective license text is not known by ORT." + "license with the license ID as the filename. A custom license text is used only if its ID has a " + + "'LicenseRef-' prefix and if the respective license text is not known by ORT." ).convert { it.expandTilde() } .file(mustExist = false, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = false) .convert { it.absoluteFile.normalize() } @@ -130,7 +130,7 @@ class ReporterCommand : OrtCommand( private val howToFixTextProviderScript by option( "--how-to-fix-text-provider-script", help = "The path to a Kotlin script which returns an instance of a 'HowToFixTextProvider'. That provider " + - "injects how-to-fix texts in Markdown format for ORT issues." + "injects how-to-fix texts in Markdown format for ORT issues." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -140,7 +140,7 @@ class ReporterCommand : OrtCommand( private val licenseClassificationsFile by option( "--license-classifications-file", help = "A file containing the license classifications. This can make the output inconsistent with the " + - "evaluator output but is useful when testing license classifications." + "evaluator output but is useful when testing license classifications." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -150,8 +150,8 @@ class ReporterCommand : OrtCommand( private val packageConfigurationsDir by option( "--package-configurations-dir", help = "A directory that is searched recursively for package configuration files. Each file must only " + - "contain a single package configuration. This can make the output inconsistent with the evaluator " + - "output but is useful when testing package configurations." + "contain a single package configuration. This can make the output inconsistent with the evaluator " + + "output but is useful when testing package configurations." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = false, canBeDir = true, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -160,15 +160,15 @@ class ReporterCommand : OrtCommand( private val refreshResolutions by option( "--refresh-resolutions", help = "Use the resolutions from the global and repository configuration instead of the resolved " + - "configuration. This can make the output inconsistent with the evaluator output but is useful when " + - "testing resolutions." + "configuration. This can make the output inconsistent with the evaluator output but is useful when " + + "testing resolutions." ).flag().configurationGroup() private val repositoryConfigurationFile by option( "--repository-configuration-file", help = "A file containing the repository configuration. If set, overrides the repository configuration " + - "contained in the ORT result input file. This can make the output inconsistent with the output of " + - "previous commands but is useful when testing changes in the repository configuration." + "contained in the ORT result input file. This can make the output inconsistent with the output of " + + "previous commands but is useful when testing changes in the repository configuration." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() } @@ -186,8 +186,8 @@ class ReporterCommand : OrtCommand( private val reportOptions by option( "--report-option", "-O", help = "Specify a report-format-specific option. The key is the (case-insensitive) name of the report " + - "format, and the value is an arbitrary key-value pair. For example: " + - "-O PlainTextTemplate=template.id=NOTICE_SUMMARY" + "format, and the value is an arbitrary key-value pair. For example: " + + "-O PlainTextTemplate=template.id=NOTICE_SUMMARY" ).splitPair().convert { (format, option) -> require(format in Reporter.ALL.keys) { "Report formats must be one or more of ${Reporter.ALL.keys}." diff --git a/plugins/commands/scanner/src/main/kotlin/ScannerCommand.kt b/plugins/commands/scanner/src/main/kotlin/ScannerCommand.kt index 480690131807..df8a12620110 100644 --- a/plugins/commands/scanner/src/main/kotlin/ScannerCommand.kt +++ b/plugins/commands/scanner/src/main/kotlin/ScannerCommand.kt @@ -81,7 +81,7 @@ class ScannerCommand : OrtCommand( option( "--ort-file", "-i", help = "An ORT result file with an analyzer result to use. Source code is downloaded automatically if " + - "needed. Must not be used together with '--input-path'." + "needed. Must not be used together with '--input-path'." ).convert { it.expandTilde() } .file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true) .convert { it.absoluteFile.normalize() }, @@ -111,7 +111,7 @@ class ScannerCommand : OrtCommand( private val labels by option( "--label", "-l", help = "Set a label in the ORT result, overwriting any existing label of the same name. Can be used multiple " + - "times. For example: --label distribution=external" + "times. For example: --label distribution=external" ).associate() private val scanners by option( @@ -122,8 +122,8 @@ class ScannerCommand : OrtCommand( private val projectScanners by option( "--project-scanners", help = "A comma-separated list of scanners to use for scanning the source code of projects. By default, " + - "projects and packages are scanned with the same scanners as specified by '--scanners'.\n" + - "Possible values are: ${ScannerWrapper.ALL.keys}" + "projects and packages are scanned with the same scanners as specified by '--scanners'.\n" + + "Possible values are: ${ScannerWrapper.ALL.keys}" ).convertToScannerWrapperFactories() private val packageTypes by option( diff --git a/plugins/commands/upload-curations/src/main/kotlin/UploadCurationsCommand.kt b/plugins/commands/upload-curations/src/main/kotlin/UploadCurationsCommand.kt index ac7d7a965d88..59e34f08ce3e 100644 --- a/plugins/commands/upload-curations/src/main/kotlin/UploadCurationsCommand.kt +++ b/plugins/commands/upload-curations/src/main/kotlin/UploadCurationsCommand.kt @@ -98,7 +98,7 @@ class UploadCurationsCommand : OrtCommand( val curationsByHarvestStatus = curations.groupBy { curation -> definitions[curationsToCoordinates[curation]]?.getHarvestStatus() ?: logger.warn { "No definition data available for package '${curation.id.toCoordinates()}', cannot request a harvest " + - "or upload curations for it." + "or upload curations for it." } } @@ -109,13 +109,13 @@ class UploadCurationsCommand : OrtCommand( println( "Package '${curation.id.toCoordinates()}' was not harvested until now, but harvesting was requested. " + - "Check $definitionUrl for the harvesting status." + "Check $definitionUrl for the harvesting status." ) } var uploadedCurationsCount = 0 val uploadableCurations = curationsByHarvestStatus[HarvestStatus.HARVESTED].orEmpty() + - curationsByHarvestStatus[HarvestStatus.PARTIALLY_HARVESTED].orEmpty() + curationsByHarvestStatus[HarvestStatus.PARTIALLY_HARVESTED].orEmpty() uploadableCurations.forEachIndexed { index, curation -> val patch = curation.toContributionPatch() @@ -164,9 +164,9 @@ private fun PackageCuration.toContributionPatch(): ContributionPatch? { type = ContributionType.OTHER, summary = "Curation for component $coordinates.", details = "Imported from curation data of the " + - "[OSS Review Toolkit](https://github.com/oss-review-toolkit/ort) via the " + - "[clearly-defined](https://github.com/oss-review-toolkit/ort/tree/main/clients/clearly-defined) " + - "module.", + "[OSS Review Toolkit](https://github.com/oss-review-toolkit/ort) via the " + + "[clearly-defined](https://github.com/oss-review-toolkit/ort/tree/main/clients/clearly-defined) " + + "module.", resolution = data.comment ?: "Unknown, original data contains no comment.", removedDefinitions = false ) diff --git a/plugins/commands/upload-result-to-postgres/src/main/kotlin/UploadResultToPostgresCommand.kt b/plugins/commands/upload-result-to-postgres/src/main/kotlin/UploadResultToPostgresCommand.kt index 4f34dc072651..51a36d1f214d 100644 --- a/plugins/commands/upload-result-to-postgres/src/main/kotlin/UploadResultToPostgresCommand.kt +++ b/plugins/commands/upload-result-to-postgres/src/main/kotlin/UploadResultToPostgresCommand.kt @@ -88,7 +88,7 @@ class UploadResultToPostgresCommand : OrtCommand( val config = configs.first() println( "Multiple PostgreSQL storages are configured, using the first one which points to schema " + - "${config.connection.schema} at ${config.connection.url}." + "${config.connection.schema} at ${config.connection.url}." ) } diff --git a/plugins/commands/upload-result-to-sw360/src/main/kotlin/UploadResultToSw360Command.kt b/plugins/commands/upload-result-to-sw360/src/main/kotlin/UploadResultToSw360Command.kt index 59f0152b9b24..f197f8b3e552 100644 --- a/plugins/commands/upload-result-to-sw360/src/main/kotlin/UploadResultToSw360Command.kt +++ b/plugins/commands/upload-result-to-sw360/src/main/kotlin/UploadResultToSw360Command.kt @@ -118,7 +118,7 @@ class UploadResultToSw360Command : OrtCommand( if (uploadResult.isSuccess) { logger.info { "Successfully uploaded source attachment '${zipFile.name}' to release " + - "${release.id}:${release.name}" + "${release.id}:${release.name}" } } else { logger.error { "Could not upload source attachment: " + uploadResult.failedUploads() } diff --git a/plugins/package-configuration-providers/api/src/main/kotlin/PackageConfigurationProviderFactory.kt b/plugins/package-configuration-providers/api/src/main/kotlin/PackageConfigurationProviderFactory.kt index 971d15224f0e..0de148922d35 100644 --- a/plugins/package-configuration-providers/api/src/main/kotlin/PackageConfigurationProviderFactory.kt +++ b/plugins/package-configuration-providers/api/src/main/kotlin/PackageConfigurationProviderFactory.kt @@ -45,14 +45,14 @@ interface PackageConfigurationProviderFactory : ConfigurablePluginFactor .apply { require(none { (id, _) -> id.isBlank() }) { "The configuration contains a package configuration provider with a blank ID which is not " + - "allowed." + "allowed." } val duplicateIds = getDuplicates { (id, _) -> id }.keys require(duplicateIds.isEmpty()) { "Found multiple package configuration providers for the IDs ${duplicateIds.joinToString()}, " + - "which is not allowed. Please configure a unique ID for each package configuration " + - "provider." + "which is not allowed. Please configure a unique ID for each package configuration " + + "provider." } } } diff --git a/plugins/package-configuration-providers/api/src/main/kotlin/SimplePackageConfigurationProvider.kt b/plugins/package-configuration-providers/api/src/main/kotlin/SimplePackageConfigurationProvider.kt index c271323bff59..95e534c90143 100644 --- a/plugins/package-configuration-providers/api/src/main/kotlin/SimplePackageConfigurationProvider.kt +++ b/plugins/package-configuration-providers/api/src/main/kotlin/SimplePackageConfigurationProvider.kt @@ -53,6 +53,6 @@ private fun Collection.checkAtMostOneConfigurationPerIdAnd require(configurationsWithSameMatcher.isEmpty()) { "There must be at most one package configuration per Id and provenance, but found multiple for:\n" + - "${configurationsWithSameMatcher.keys.joinToString(prefix = " ", separator = "\n ")}." + "${configurationsWithSameMatcher.keys.joinToString(prefix = " ", separator = "\n ")}." } } diff --git a/plugins/package-configuration-providers/ort-config/src/test/kotlin/OrtConfigPackageConfigurationProviderFunTest.kt b/plugins/package-configuration-providers/ort-config/src/test/kotlin/OrtConfigPackageConfigurationProviderFunTest.kt index 7ead040419b6..f5448757bb60 100644 --- a/plugins/package-configuration-providers/ort-config/src/test/kotlin/OrtConfigPackageConfigurationProviderFunTest.kt +++ b/plugins/package-configuration-providers/ort-config/src/test/kotlin/OrtConfigPackageConfigurationProviderFunTest.kt @@ -34,7 +34,7 @@ class OrtConfigPackageConfigurationProviderFunTest : StringSpec({ val provenance = ArtifactProvenance( RemoteArtifact( url = "https://repo.maven.apache.org/maven2/net/java/dev/jna/jna-platform/5.8.0/" + - "jna-platform-5.8.0-sources.jar", + "jna-platform-5.8.0-sources.jar", hash = Hash.NONE ) ) diff --git a/plugins/package-curation-providers/api/src/main/kotlin/PackageCurationProviderFactory.kt b/plugins/package-curation-providers/api/src/main/kotlin/PackageCurationProviderFactory.kt index b31f333f3e39..00683bdf15d8 100644 --- a/plugins/package-curation-providers/api/src/main/kotlin/PackageCurationProviderFactory.kt +++ b/plugins/package-curation-providers/api/src/main/kotlin/PackageCurationProviderFactory.kt @@ -51,12 +51,12 @@ interface PackageCurationProviderFactory : ConfigurablePluginFactory id }.keys require(duplicateIds.isEmpty()) { "Found multiple package curation providers for the IDs ${duplicateIds.joinToString()}, which is " + - "not allowed. Please configure a unique ID for each package curation provider." + "not allowed. Please configure a unique ID for each package curation provider." } require(none { (id, _) -> id == REPOSITORY_CONFIGURATION_PROVIDER_ID }) { "Found a package curation provider which uses '$REPOSITORY_CONFIGURATION_PROVIDER_ID' as its id " + - "which is reserved and not allowed." + "which is reserved and not allowed." } } } diff --git a/plugins/package-curation-providers/clearly-defined/src/funTest/kotlin/ClearlyDefinedPackageCurationProviderFunTest.kt b/plugins/package-curation-providers/clearly-defined/src/funTest/kotlin/ClearlyDefinedPackageCurationProviderFunTest.kt index 92d5c2af7968..951d3b23f2ca 100644 --- a/plugins/package-curation-providers/clearly-defined/src/funTest/kotlin/ClearlyDefinedPackageCurationProviderFunTest.kt +++ b/plugins/package-curation-providers/clearly-defined/src/funTest/kotlin/ClearlyDefinedPackageCurationProviderFunTest.kt @@ -44,7 +44,7 @@ class ClearlyDefinedPackageCurationProviderFunTest : WordSpec({ val curations = provider.getCurationsFor(packages) curations.map { it.data.concludedLicense } shouldHaveSingleElement - "CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0".toSpdx() + "CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0".toSpdx() } } @@ -55,7 +55,7 @@ class ClearlyDefinedPackageCurationProviderFunTest : WordSpec({ val curations = provider.getCurationsFor(packages) curations.map { it.data.vcs?.revision } shouldHaveSingleElement - "0b97c416e42a184ff9728877b461c616187c58f7" + "0b97c416e42a184ff9728877b461c616187c58f7" } } diff --git a/plugins/package-managers/bundler/src/funTest/kotlin/BundlerFunTest.kt b/plugins/package-managers/bundler/src/funTest/kotlin/BundlerFunTest.kt index afb653ac734a..5b99588ea672 100644 --- a/plugins/package-managers/bundler/src/funTest/kotlin/BundlerFunTest.kt +++ b/plugins/package-managers/bundler/src/funTest/kotlin/BundlerFunTest.kt @@ -49,9 +49,9 @@ class BundlerFunTest : WordSpec({ with(actualResult) { project.id shouldBe - Identifier("Bundler::src/funTest/assets/projects/synthetic/no-lockfile/Gemfile:") + Identifier("Bundler::src/funTest/assets/projects/synthetic/no-lockfile/Gemfile:") project.definitionFilePath shouldBe - "plugins/package-managers/bundler/src/funTest/assets/projects/synthetic/no-lockfile/Gemfile" + "plugins/package-managers/bundler/src/funTest/assets/projects/synthetic/no-lockfile/Gemfile" packages should beEmpty() issues.size shouldBe 1 issues.first().message should haveSubstring("IllegalArgumentException: No lockfile found in") diff --git a/plugins/package-managers/bundler/src/main/kotlin/Bundler.kt b/plugins/package-managers/bundler/src/main/kotlin/Bundler.kt index 6b5538fa060c..a5d0a9bef7d8 100644 --- a/plugins/package-managers/bundler/src/main/kotlin/Bundler.kt +++ b/plugins/package-managers/bundler/src/main/kotlin/Bundler.kt @@ -248,7 +248,7 @@ class Bundler( ) { logger.debug { "Parsing scope '$groupName' with top-level dependencies $dependencyList for project " + - "'${projectId.toCoordinates()}' in '$workingDir'." + "'${projectId.toCoordinates()}' in '$workingDir'." } val scopeDependencies = mutableSetOf() @@ -300,7 +300,7 @@ class Bundler( issues += createAndLogIssue( source = managerName, message = "Failed to parse dependency '$gemName' of project '${projectId.toCoordinates()}' in " + - "'$workingDir': ${it.collectMessages()}" + "'$workingDir': ${it.collectMessages()}" ) } } @@ -375,7 +375,7 @@ class Bundler( OkHttpClientHelper.HTTP_TOO_MANY_REQUESTS -> { throw IOException( "RubyGems reported too many requests when requesting metadata for gem '$name', see " + - "https://guides.rubygems.org/rubygems-org-api/#rate-limits." + "https://guides.rubygems.org/rubygems-org-api/#rate-limits." ) } diff --git a/plugins/package-managers/carthage/src/test/kotlin/CarthageTest.kt b/plugins/package-managers/carthage/src/test/kotlin/CarthageTest.kt index f161ffb5ebc6..abe006e9ed5b 100644 --- a/plugins/package-managers/carthage/src/test/kotlin/CarthageTest.kt +++ b/plugins/package-managers/carthage/src/test/kotlin/CarthageTest.kt @@ -82,7 +82,7 @@ class CarthageTest : WordSpec() { "parse a binary dependency url" { mockkStatic("kotlin.io.TextStreamsKt") every { URI.create("https://host.tld/path/to/binary/spec.json").toURL().readBytes() } returns - File("src/test/assets/Carthage-binary-specification.json").readText().toByteArray() + File("src/test/assets/Carthage-binary-specification.json").readText().toByteArray() val cartfile = File("src/test/assets/Cartfile-binary.resolved") @@ -100,7 +100,7 @@ class CarthageTest : WordSpec() { "parse mixed dependencies" { mockkStatic("kotlin.io.TextStreamsKt") every { URI.create("https://host.tld/path/to/binary/spec.json").toURL().readBytes() } returns - File("src/test/assets/Carthage-binary-specification.json").readText().toByteArray() + File("src/test/assets/Carthage-binary-specification.json").readText().toByteArray() val cartfile = File("src/test/assets/Cartfile-mixed.resolved") diff --git a/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt b/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt index 224494acd39e..325ac1444a7e 100644 --- a/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt +++ b/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt @@ -135,8 +135,8 @@ class CocoaPods( issues += createAndLogIssue( source = managerName, message = "Missing lockfile '${lockfile.relativeTo(analysisRoot).invariantSeparatorsPath}' for " + - "definition file '${definitionFile.relativeTo(analysisRoot).invariantSeparatorsPath}'. The " + - "analysis of a Podfile without a lockfile is not supported." + "definition file '${definitionFile.relativeTo(analysisRoot).invariantSeparatorsPath}'. The " + + "analysis of a Podfile without a lockfile is not supported." ) } diff --git a/plugins/package-managers/composer/src/funTest/kotlin/ComposerFunTest.kt b/plugins/package-managers/composer/src/funTest/kotlin/ComposerFunTest.kt index 4249ec94600c..ab231aae7ba6 100644 --- a/plugins/package-managers/composer/src/funTest/kotlin/ComposerFunTest.kt +++ b/plugins/package-managers/composer/src/funTest/kotlin/ComposerFunTest.kt @@ -51,7 +51,7 @@ class ComposerFunTest : StringSpec({ "Composer::src/funTest/assets/projects/synthetic/no-lockfile/composer.json:" ) project.definitionFilePath shouldBe "plugins/package-managers/composer/src/funTest/assets/projects/" + - "synthetic/no-lockfile/composer.json" + "synthetic/no-lockfile/composer.json" packages should beEmpty() issues.size shouldBe 1 issues.first().message should haveSubstring("IllegalArgumentException: No lockfile found in") diff --git a/plugins/package-managers/composer/src/main/kotlin/Composer.kt b/plugins/package-managers/composer/src/main/kotlin/Composer.kt index 2afc85f9ad9e..acecbb5b7e0d 100644 --- a/plugins/package-managers/composer/src/main/kotlin/Composer.kt +++ b/plugins/package-managers/composer/src/main/kotlin/Composer.kt @@ -185,7 +185,7 @@ class Composer( if (packageName in dependencyBranch) { logger.debug { "Not adding circular dependency '$packageName' to the tree, it is already on this branch of the " + - "dependency tree: ${dependencyBranch.joinToString(" -> ")}." + "dependency tree: ${dependencyBranch.joinToString(" -> ")}." } return@forEach diff --git a/plugins/package-managers/conan/src/main/kotlin/Conan.kt b/plugins/package-managers/conan/src/main/kotlin/Conan.kt index c20195257ffc..ab3e83ef290b 100644 --- a/plugins/package-managers/conan/src/main/kotlin/Conan.kt +++ b/plugins/package-managers/conan/src/main/kotlin/Conan.kt @@ -172,12 +172,12 @@ class Conan( val dependenciesScope = Scope( name = SCOPE_NAME_DEPENDENCIES, dependencies = - parseDependencies(pkgInfos, definitionFile.name, SCOPE_NAME_DEPENDENCIES, workingDir) + parseDependencies(pkgInfos, definitionFile.name, SCOPE_NAME_DEPENDENCIES, workingDir) ) val devDependenciesScope = Scope( name = SCOPE_NAME_DEV_DEPENDENCIES, dependencies = - parseDependencies(pkgInfos, definitionFile.name, SCOPE_NAME_DEV_DEPENDENCIES, workingDir) + parseDependencies(pkgInfos, definitionFile.name, SCOPE_NAME_DEV_DEPENDENCIES, workingDir) ) val projectPackage = parseProjectPackage(pkgInfos, definitionFile, workingDir) @@ -207,8 +207,8 @@ class Conan( private fun verifyLockfileBelongsToProject(workingDir: File, lockfileName: String?) { require(workingDir.resolve(lockfileName.orEmpty()).canonicalFile.startsWith(workingDir.canonicalFile)) { "The provided lockfile path points to the directory outside of the analyzed project: '$lockfileName' and " + - "potentially does not belong to the project. Please move the lockfile to the '$workingDir' and " + - "set the path in '$ORT_CONFIG_FILENAME' accordingly." + "potentially does not belong to the project. Please move the lockfile to the '$workingDir' and " + + "set the path in '$ORT_CONFIG_FILENAME' accordingly." } } @@ -276,7 +276,7 @@ class Conan( val id = parsePackageId(pkgInfo, workingDir) val dependencies = parseDependencyTree(pkgInfos, pkgInfo, SCOPE_NAME_DEPENDENCIES, workingDir) + - parseDependencyTree(pkgInfos, pkgInfo, SCOPE_NAME_DEV_DEPENDENCIES, workingDir) + parseDependencyTree(pkgInfos, pkgInfo, SCOPE_NAME_DEV_DEPENDENCIES, workingDir) this += PackageReference(id, dependencies = dependencies) } diff --git a/plugins/package-managers/gradle-inspector/src/main/kotlin/GradleInspector.kt b/plugins/package-managers/gradle-inspector/src/main/kotlin/GradleInspector.kt index 5a5fa1b53af2..ed77c926c6cc 100644 --- a/plugins/package-managers/gradle-inspector/src/main/kotlin/GradleInspector.kt +++ b/plugins/package-managers/gradle-inspector/src/main/kotlin/GradleInspector.kt @@ -119,18 +119,18 @@ class GradleInspector( private fun extractInitScript(): File { fun extractResource(name: String, target: File) = target.apply { - val resource = checkNotNull(GradleInspector::class.java.getResource(name)) { - "Resource '$name' not found." - } + val resource = checkNotNull(GradleInspector::class.java.getResource(name)) { + "Resource '$name' not found." + } - logger.debug { "Extracting resource '${resource.path.substringAfterLast('/')}' to '$target'..." } + logger.debug { "Extracting resource '${resource.path.substringAfterLast('/')}' to '$target'..." } - resource.openStream().use { inputStream -> - outputStream().use { outputStream -> - inputStream.copyTo(outputStream) + resource.openStream().use { inputStream -> + outputStream().use { outputStream -> + inputStream.copyTo(outputStream) + } } } - } val toolsDir = ortToolsDirectory.resolve(managerName).apply { safeMkdirs() } val pluginJar = extractResource("/gradle-plugin.jar", toolsDir.resolve("gradle-plugin.jar")) @@ -169,14 +169,14 @@ class GradleInspector( if (stdout.size() > 0) { logger.debug { "Analyzing the project in '$projectDir' produced the following standard output:\n" + - stdout.toString().prependIndent("\t") + stdout.toString().prependIndent("\t") } } if (stderr.size() > 0) { logger.warn { "Analyzing the project in '$projectDir' produced the following error output:\n" + - stderr.toString().prependIndent("\t") + stderr.toString().prependIndent("\t") } } @@ -253,7 +253,7 @@ class GradleInspector( val isSpringMetadataProject = with(id) { listOf("boot", "cloud").any { namespace == "org.springframework.$it" - && (name.startsWith("spring-$it-starter") || name.startsWith("spring-$it-contract-spec")) + && (name.startsWith("spring-$it-starter") || name.startsWith("spring-$it-contract-spec")) } } diff --git a/plugins/package-managers/gradle-plugin/src/main/kotlin/GradleModelExtensions.kt b/plugins/package-managers/gradle-plugin/src/main/kotlin/GradleModelExtensions.kt index 8f23a92a817f..f465927a77ca 100644 --- a/plugins/package-managers/gradle-plugin/src/main/kotlin/GradleModelExtensions.kt +++ b/plugins/package-managers/gradle-plugin/src/main/kotlin/GradleModelExtensions.kt @@ -41,7 +41,7 @@ internal fun Configuration.isRelevant(): Boolean { // Check if a configuration is deprecated in favor of alternatives. val isDeprecatedConfiguration = GradleVersion.current() >= GradleVersion.version("6.0") - && this is DeprecatableConfiguration && !resolutionAlternatives.isNullOrEmpty() + && this is DeprecatableConfiguration && !resolutionAlternatives.isNullOrEmpty() // Do not try to resolve dependencies metadata configurations as there often cause failures with Gradle itself. See // https://developer.android.com/build/releases/past-releases/agp-4-0-0-release-notes#dependency-metadata and diff --git a/plugins/package-managers/gradle/src/main/kotlin/Gradle.kt b/plugins/package-managers/gradle/src/main/kotlin/Gradle.kt index 038e29ccf3d8..bbce0b4d9847 100644 --- a/plugins/package-managers/gradle/src/main/kotlin/Gradle.kt +++ b/plugins/package-managers/gradle/src/main/kotlin/Gradle.kt @@ -221,14 +221,14 @@ class Gradle( if (stdout.size() > 0) { logger.debug { "Analyzing the project in '$projectDir' produced the following standard output:\n" + - stdout.toString().prependIndent("\t") + stdout.toString().prependIndent("\t") } } if (stderr.size() > 0) { logger.warn { "Analyzing the project in '$projectDir' produced the following error output:\n" + - stderr.toString().prependIndent("\t") + stderr.toString().prependIndent("\t") } } diff --git a/plugins/package-managers/gradle/src/main/kotlin/GradleDependencyHandler.kt b/plugins/package-managers/gradle/src/main/kotlin/GradleDependencyHandler.kt index 42545ba55925..8350731c3b64 100644 --- a/plugins/package-managers/gradle/src/main/kotlin/GradleDependencyHandler.kt +++ b/plugins/package-managers/gradle/src/main/kotlin/GradleDependencyHandler.kt @@ -110,7 +110,7 @@ internal class GradleDependencyHandler( issues += createAndLogIssue( source = managerName, message = "Could not get package information for dependency '${artifact.identifier()}': " + - e.collectMessages() + e.collectMessages() ) null diff --git a/plugins/package-managers/node/src/funTest/kotlin/PnpmFunTest.kt b/plugins/package-managers/node/src/funTest/kotlin/PnpmFunTest.kt index 7b6615217553..4b0ea50ec8e9 100644 --- a/plugins/package-managers/node/src/funTest/kotlin/PnpmFunTest.kt +++ b/plugins/package-managers/node/src/funTest/kotlin/PnpmFunTest.kt @@ -48,7 +48,7 @@ class PnpmFunTest : WordSpec({ val ortResult = analyze(definitionFile.parentFile, packageManagers = setOf(Pnpm.Factory())) patchActualResult(ortResult.toYaml(), patchStartAndEndTime = true) should - matchExpectedResult(expectedResultFile, definitionFile) + matchExpectedResult(expectedResultFile, definitionFile) } } }) diff --git a/plugins/package-managers/node/src/main/kotlin/Npm.kt b/plugins/package-managers/node/src/main/kotlin/Npm.kt index d9b653e23412..34b2d36849f1 100644 --- a/plugins/package-managers/node/src/main/kotlin/Npm.kt +++ b/plugins/package-managers/node/src/main/kotlin/Npm.kt @@ -335,7 +335,7 @@ open class Npm( vcsFromPackage = vcsFromPackage.merge(vcsFromDirectory) } else { val hasIncompleteData = description.isEmpty() || homepageUrl.isEmpty() || downloadUrl.isEmpty() - || hash == Hash.NONE || vcsFromPackage == VcsInfo.EMPTY + || hash == Hash.NONE || vcsFromPackage == VcsInfo.EMPTY if (hasIncompleteData) { runCatching { @@ -490,7 +490,7 @@ open class Npm( logger.debug { "It seems that the '$dependencyName' module was not installed as the package file could not be found " + "anywhere in '${pathToRoot.joinToString()}'. This might be fine if the module is specific to a " + - "platform other than the one ORT is running on. A typical example is the 'fsevents' module." + "platform other than the one ORT is running on. A typical example is the 'fsevents' module." } } diff --git a/plugins/package-managers/node/src/main/kotlin/Yarn2.kt b/plugins/package-managers/node/src/main/kotlin/Yarn2.kt index c33a4603057e..c696662bed5f 100644 --- a/plugins/package-managers/node/src/main/kotlin/Yarn2.kt +++ b/plugins/package-managers/node/src/main/kotlin/Yarn2.kt @@ -351,7 +351,7 @@ class Yarn2( if ("Yarn2" in dependency.type) { val projectAsDependency = allProjects.entries.find { entry -> entry.key.type == "Yarn2" && entry.key.name == dependency.name && - entry.key.namespace == dependency.namespace + entry.key.namespace == dependency.namespace } if (projectAsDependency == null) { @@ -515,7 +515,7 @@ class Yarn2( return YarnDependencyType.entries.associateWith { dependencyType -> id to dependencies.filter { dependencyToType[it.name] == dependencyType - || (it.name !in dependencyToType && dependencyType == YarnDependencyType.DEPENDENCIES) + || (it.name !in dependencyToType && dependencyType == YarnDependencyType.DEPENDENCIES) } } } diff --git a/plugins/package-managers/node/src/main/kotlin/utils/NpmSupport.kt b/plugins/package-managers/node/src/main/kotlin/utils/NpmSupport.kt index 9eb0fe607ea4..86049f89d515 100644 --- a/plugins/package-managers/node/src/main/kotlin/utils/NpmSupport.kt +++ b/plugins/package-managers/node/src/main/kotlin/utils/NpmSupport.kt @@ -211,14 +211,14 @@ private fun getPackageJsonInfo(definitionFiles: Set): Collection @@ -213,11 +213,11 @@ class NpmSupportTest : WordSpec() { "not mess with crazy URLs" { val packages = mapOf( "git@github.com/cisco/node-jose.git" - to "git@github.com/cisco/node-jose.git", + to "git@github.com/cisco/node-jose.git", "https://git@github.com:hacksparrow/node-easyimage.git" - to "https://git@github.com:hacksparrow/node-easyimage.git", + to "https://git@github.com:hacksparrow/node-easyimage.git", "github.com/improbable-eng/grpc-web" - to "github.com/improbable-eng/grpc-web" + to "github.com/improbable-eng/grpc-web" ) packages.entries.forAll { (actualUrl, expectedUrl) -> diff --git a/plugins/package-managers/nuget/src/main/kotlin/utils/NuGetInspector.kt b/plugins/package-managers/nuget/src/main/kotlin/utils/NuGetInspector.kt index a727c51bbb1a..8570649a8cda 100644 --- a/plugins/package-managers/nuget/src/main/kotlin/utils/NuGetInspector.kt +++ b/plugins/package-managers/nuget/src/main/kotlin/utils/NuGetInspector.kt @@ -193,7 +193,7 @@ private fun List.toPackageReferences(): Set.toOrtPackages(): Set diff --git a/plugins/package-managers/spdx/src/main/kotlin/utils/SpdxResolvedDocument.kt b/plugins/package-managers/spdx/src/main/kotlin/utils/SpdxResolvedDocument.kt index c75dbf387c12..3f647a5d146c 100644 --- a/plugins/package-managers/spdx/src/main/kotlin/utils/SpdxResolvedDocument.kt +++ b/plugins/package-managers/spdx/src/main/kotlin/utils/SpdxResolvedDocument.kt @@ -277,7 +277,7 @@ internal fun SpdxExternalDocumentReference.resolve( issue = SpdxResolvedDocument.createAndLogIssue( source = managerName, message = "The SPDX document at '$spdxDocument' cannot be resolved as a URI (referred from $baseUri " + - "as part of '$externalDocumentId')." + "as part of '$externalDocumentId')." ) ) } @@ -316,7 +316,7 @@ private fun SpdxExternalDocumentReference.resolveFromFile( issue = SpdxResolvedDocument.createAndLogIssue( source = managerName, message = "Failed to parse the SPDX document pointed to by '$uri' in reference " + - "'$externalDocumentId': ${it.message}" + "'$externalDocumentId': ${it.message}" ) ) } @@ -357,7 +357,7 @@ private fun SpdxExternalDocumentReference.resolveFromDownload( issue = SpdxResolvedDocument.createAndLogIssue( source = managerName, message = "Failed to download SPDX document from $uri (referred from $baseUri as part of " + - "'$externalDocumentId'): ${it.collectMessages()}" + "'$externalDocumentId'): ${it.collectMessages()}" ) ) } @@ -369,7 +369,7 @@ private fun SpdxExternalDocumentReference.resolveFromDownload( issue = SpdxResolvedDocument.createAndLogIssue( source = managerName, message = "Failed to parse SPDX document from $uri (referred from $baseUri as part of " + - "'$externalDocumentId'): ${it.message}" + "'$externalDocumentId'): ${it.message}" ) ) } @@ -392,7 +392,7 @@ private fun SpdxExternalDocumentReference.verifyChecksum(file: File, uri: URI, m source = managerName, severity = Severity.WARNING, message = "The SPDX document at '$spdxDocument' does not match the expected $hash (referred from $uri as " + - "part of '$externalDocumentId')." + "part of '$externalDocumentId')." ) } diff --git a/plugins/package-managers/unmanaged/src/main/kotlin/Unmanaged.kt b/plugins/package-managers/unmanaged/src/main/kotlin/Unmanaged.kt index 8ac08230e3d7..1795ccd5fca1 100644 --- a/plugins/package-managers/unmanaged/src/main/kotlin/Unmanaged.kt +++ b/plugins/package-managers/unmanaged/src/main/kotlin/Unmanaged.kt @@ -74,7 +74,7 @@ class Unmanaged( // a VCS working tree. In this case we have no chance to get a version. logger.warn { "Analysis of local directory '$definitionFile' which is not under version control will produce " + - "non-cacheable results as no version for the cache key can be determined." + "non-cacheable results as no version for the cache key can be determined." } Identifier( diff --git a/plugins/reporters/ctrlx/src/main/kotlin/CtrlXAutomationModel.kt b/plugins/reporters/ctrlx/src/main/kotlin/CtrlXAutomationModel.kt index 4767ba53ecf3..375c0db03d4f 100644 --- a/plugins/reporters/ctrlx/src/main/kotlin/CtrlXAutomationModel.kt +++ b/plugins/reporters/ctrlx/src/main/kotlin/CtrlXAutomationModel.kt @@ -35,7 +35,7 @@ data class FossInfo( */ @SerialName("\$schema") val schema: String? = "https://github.com/boschrexroth/json-schema/blob/a84eab6/ctrlx-automation/ctrlx-core/apps/" + - "fossinfo/fossinfo.v1.schema.json", + "fossinfo/fossinfo.v1.schema.json", /** * An inlined OSS component, in case of a single component. diff --git a/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt b/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt index b648077ea55a..7cf967727228 100644 --- a/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt +++ b/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt @@ -260,8 +260,8 @@ class CycloneDxReporter : Reporter { // Get all licenses, but note down their origins inside an extensible type. val licenseObjects = concludedLicenseNames.mapNamesToLicenses("concluded license", input) + - declaredLicenseNames.mapNamesToLicenses("declared license", input) + - detectedLicenseNames.mapNamesToLicenses("detected license", input) + declaredLicenseNames.mapNamesToLicenses("declared license", input) + + detectedLicenseNames.mapNamesToLicenses("detected license", input) val binaryHash = mapHash(pkg.binaryArtifact.hash) val sourceHash = mapHash(pkg.sourceArtifact.hash) diff --git a/plugins/reporters/evaluated-model/src/main/kotlin/EvaluatedModelMapper.kt b/plugins/reporters/evaluated-model/src/main/kotlin/EvaluatedModelMapper.kt index 60d5c8d0ba23..431f2c6b448d 100644 --- a/plugins/reporters/evaluated-model/src/main/kotlin/EvaluatedModelMapper.kt +++ b/plugins/reporters/evaluated-model/src/main/kotlin/EvaluatedModelMapper.kt @@ -457,14 +457,14 @@ internal class EvaluatedModelMapper(private val input: ReporterInput) { issues: List, children: List = emptyList() ) = DependencyTreeNode( - linkage = linkage, - pkg = dependency, - scope = null, - children = children, - pathExcludes = emptyList(), - scopeExcludes = emptyList(), - issues = issues - ) + linkage = linkage, + pkg = dependency, + scope = null, + children = children, + pathExcludes = emptyList(), + scopeExcludes = emptyList(), + issues = issues + ) fun DependencyNode.toEvaluatedTreeNode( scope: EvaluatedScope, @@ -502,7 +502,7 @@ internal class EvaluatedModelMapper(private val input: ReporterInput) { } else { node.toEvaluatedTreeNode(scope, path + dependency) } - }.toList() + }.toList() } return createDependencyNode(dependency, linkage, issues, children) diff --git a/plugins/reporters/evaluated-model/src/main/kotlin/MetadataCalculator.kt b/plugins/reporters/evaluated-model/src/main/kotlin/MetadataCalculator.kt index 5cfc9683ef7a..14ca01a1a14d 100644 --- a/plugins/reporters/evaluated-model/src/main/kotlin/MetadataCalculator.kt +++ b/plugins/reporters/evaluated-model/src/main/kotlin/MetadataCalculator.kt @@ -29,6 +29,6 @@ import org.ossreviewtoolkit.model.OrtResult internal class MetadataCalculator { fun getMetadata(ortResult: OrtResult) = Metadata( - analyzerStartTime = ortResult.analyzer?.startTime ?: Instant.now() - ) + analyzerStartTime = ortResult.analyzer?.startTime ?: Instant.now() + ) } diff --git a/plugins/reporters/freemarker/src/test/kotlin/FreeMarkerTemplateProcessorTest.kt b/plugins/reporters/freemarker/src/test/kotlin/FreeMarkerTemplateProcessorTest.kt index 9225fcaf62ab..df5487acd2b7 100644 --- a/plugins/reporters/freemarker/src/test/kotlin/FreeMarkerTemplateProcessorTest.kt +++ b/plugins/reporters/freemarker/src/test/kotlin/FreeMarkerTemplateProcessorTest.kt @@ -436,8 +436,8 @@ class FreeMarkerTemplateProcessorTest : WordSpec({ val advisorResult = advisorResult(issues = listOf(issue)) val advisorRun = advisorRunOf( - idSubProject to listOf(advisorResult), - idRootProject to listOf(advisorResult()) + idSubProject to listOf(advisorResult), + idRootProject to listOf(advisorResult()) ) val ortResult = ORT_RESULT.copy(advisor = advisorRun) val input = ReporterInput(ortResult) diff --git a/plugins/reporters/gitlab/src/main/kotlin/GitLabLicenseModel.kt b/plugins/reporters/gitlab/src/main/kotlin/GitLabLicenseModel.kt index a94da0804550..637b3f3f93ed 100644 --- a/plugins/reporters/gitlab/src/main/kotlin/GitLabLicenseModel.kt +++ b/plugins/reporters/gitlab/src/main/kotlin/GitLabLicenseModel.kt @@ -117,6 +117,6 @@ private inline fun sortedCollectionSerializer(comparator: Comparator val delegate = serializer>() return object : KSerializer> by delegate { override fun serialize(encoder: Encoder, value: Collection) = - delegate.serialize(encoder, value.sortedWith(comparator)) + delegate.serialize(encoder, value.sortedWith(comparator)) } } diff --git a/plugins/reporters/opossum/src/funTest/kotlin/OpossumReporterFunTest.kt b/plugins/reporters/opossum/src/funTest/kotlin/OpossumReporterFunTest.kt index 567d7a70ffea..04c52ac6a6cd 100644 --- a/plugins/reporters/opossum/src/funTest/kotlin/OpossumReporterFunTest.kt +++ b/plugins/reporters/opossum/src/funTest/kotlin/OpossumReporterFunTest.kt @@ -51,8 +51,8 @@ class OpossumReporterFunTest : WordSpec({ get("attributionBreakpoints").size() shouldBe 4 get("externalAttributionSources").size() shouldBe 6 get("resourcesToAttributions").fieldNames().asSequence() shouldContain - "/analyzer/src/funTest/assets/projects/synthetic/gradle/lib/build.gradle/" + - "compile/org.apache.commons/commons-text@1.1/dependencies/org.apache.commons/commons-lang3@3.5" + "/analyzer/src/funTest/assets/projects/synthetic/gradle/lib/build.gradle/" + + "compile/org.apache.commons/commons-text@1.1/dependencies/org.apache.commons/commons-lang3@3.5" } } } diff --git a/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt b/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt index d472bce251f7..906436bc1512 100644 --- a/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt +++ b/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt @@ -98,34 +98,34 @@ class OpossumReporter : Reporter { ) { fun toJson(): Map<*, *> = sortedMapOf( - uuid.toString() to sortedMapOf( - "source" to sortedMapOf( - "name" to source, - "documentConfidence" to 80 - ), - "attributionConfidence" to 80, - "packageType" to id?.getPurlType(), - "packageNamespace" to id?.namespace, - "packageName" to id?.name, - "packageVersion" to id?.version, - "copyright" to copyright, - "licenseName" to license?.toString(), - "url" to url, - "preSelected" to preselected, - "followUp" to "FOLLOW_UP".takeIf { followUp }, - "excludeFromNotice" to excludeFromNotice, - "comment" to comment + uuid.toString() to sortedMapOf( + "source" to sortedMapOf( + "name" to source, + "documentConfidence" to 80 + ), + "attributionConfidence" to 80, + "packageType" to id?.getPurlType(), + "packageNamespace" to id?.namespace, + "packageName" to id?.name, + "packageVersion" to id?.version, + "copyright" to copyright, + "licenseName" to license?.toString(), + "url" to url, + "preSelected" to preselected, + "followUp" to "FOLLOW_UP".takeIf { followUp }, + "excludeFromNotice" to excludeFromNotice, + "comment" to comment + ) ) - ) fun matches(other: OpossumSignal): Boolean = source == other.source - && id == other.id - && url == other.url - && license == other.license - && copyright == other.copyright - && comment == other.comment - && preselected == other.preselected + && id == other.id + && url == other.url + && license == other.license + && copyright == other.copyright + && comment == other.comment + && preselected == other.preselected } internal data class OpossumResources( @@ -179,10 +179,10 @@ class OpossumReporter : Reporter { ) : Comparable { fun toJson(): Map<*, *> = sortedMapOf( - "shortName" to shortName, - "fullName" to fullName, - "defaultText" to defaultText - ) + "shortName" to shortName, + "fullName" to fullName, + "defaultText" to defaultText + ) override fun compareTo(other: OpossumFrequentLicense) = compareValuesBy( diff --git a/plugins/reporters/opossum/src/test/kotlin/OpossumReporterTest.kt b/plugins/reporters/opossum/src/test/kotlin/OpossumReporterTest.kt index 5566b3e62ec3..495edb5f03c5 100644 --- a/plugins/reporters/opossum/src/test/kotlin/OpossumReporterTest.kt +++ b/plugins/reporters/opossum/src/test/kotlin/OpossumReporterTest.kt @@ -118,12 +118,12 @@ class OpossumReporterTest : WordSpec({ fileList shouldContain "/" fileList shouldContain "/pom.xml/compile/first-package-group/first-package@0.0.1/LICENSE" fileList shouldContain "/npm-project/package.json/devDependencies/@something/somepackage@1.2.3/" + - "dependencies/@something/somepackage-dep@1.2.3/dependencies/" + - "@something/somepackage-dep-dep@1.2.3/dependencies/@something/somepackage-dep-dep-dep@1.2.3" + "dependencies/@something/somepackage-dep@1.2.3/dependencies/" + + "@something/somepackage-dep-dep@1.2.3/dependencies/@something/somepackage-dep-dep-dep@1.2.3" opossumInput.attributionBreakpoints shouldContain "/npm-project/package.json/devDependencies/" + - "@something/somepackage@1.2.3/dependencies/@something/somepackage-dep@1.2.3/dependencies/" + - "@something/somepackage-dep-dep@1.2.3/dependencies/" + "@something/somepackage@1.2.3/dependencies/@something/somepackage-dep@1.2.3/dependencies/" + + "@something/somepackage-dep-dep@1.2.3/dependencies/" } "create a file list that contains files from other lists" { @@ -203,9 +203,9 @@ class OpossumReporterTest : WordSpec({ "create valid baseUrlsForSources" { opossumInput.baseUrlsForSources["/"] shouldBe "https://github.com/path/first-project/" + - "tree/master/sub/path/{path}" + "tree/master/sub/path/{path}" opossumInput.baseUrlsForSources["/pom.xml/compile/first-package-group/first-package@0.0.1/"] shouldBe - "https://github.com/path/first-package-repo/tree/master/project-path/{path}" + "https://github.com/path/first-package-repo/tree/master/project-path/{path}" } "create issues containing all issues" { @@ -235,8 +235,8 @@ class OpossumReporterTest : WordSpec({ "exclude scopes" { fileListWithExcludedScopes shouldNotContain "/npm-project/package.json/devDependencies/@something/" + - "somepackage@1.2.3/dependencies/@something/somepackage-dep@1.2.3/dependencies/@something/" + - "somepackage-dep-dep@1.2.3/dependencies/@something/somepackage-dep-dep-dep@1.2.3" + "somepackage@1.2.3/dependencies/@something/somepackage-dep@1.2.3/dependencies/@something/" + + "somepackage-dep-dep@1.2.3/dependencies/@something/somepackage-dep-dep-dep@1.2.3" } } }) @@ -317,7 +317,7 @@ private fun createOrtResult(): OrtResult { PackageReference( id = Identifier( "NPM:@something:" + - "somepackage-dep-dep-dep:1.2.3" + "somepackage-dep-dep-dep:1.2.3" ) ) ) @@ -339,8 +339,8 @@ private fun createOrtResult(): OrtResult { concludedLicense = "BSD-2-Clause AND BSD-3-Clause AND MIT".toSpdx(), declaredLicenses = setOf("BSD-3-Clause", "MIT OR GPL-2.0-only"), description = "A package with all supported attributes set, with a VCS URL containing a user " + - "name, and with a scan result containing two copyright finding matched to a license " + - "finding.", + "name, and with a scan result containing two copyright finding matched to a license " + + "finding.", homepageUrl = "first package's homepage URL", sourceArtifact = RemoteArtifact("https://some-host/first-package-sources.jar", Hash.NONE), vcs = VcsInfo( @@ -383,7 +383,7 @@ private fun createOrtResult(): OrtResult { declaredLicenses = setOf("LicenseRef-scancode-philips-proprietary-notice-2000"), concludedLicense = "LicenseRef-scancode-purdue-bsd".toSpdx(), description = "A package used only from the excluded 'test' scope, with non-SPDX license IDs " + - "in the declared and concluded license.", + "in the declared and concluded license.", homepageUrl = "", sourceArtifact = RemoteArtifact.EMPTY, vcs = VcsInfo.EMPTY diff --git a/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt b/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt index 4149087cda8f..5d034cd1848d 100644 --- a/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt +++ b/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt @@ -142,11 +142,11 @@ private fun TestConfiguration.generateReport( private fun SpdxDocument.getCustomReplacements() = mapOf( - "" to SpdxLicense.LICENSE_LIST_VERSION.substringBefore("-"), - "" to Environment.ORT_VERSION, - "" to creationInfo.created.toString(), - "" to documentNamespace -) + "" to SpdxLicense.LICENSE_LIST_VERSION.substringBefore("-"), + "" to Environment.ORT_VERSION, + "" to creationInfo.created.toString(), + "" to documentNamespace + ) private val analyzedVcs = VcsInfo( type = VcsType.GIT, @@ -225,8 +225,8 @@ private val ortResult = OrtResult( concludedLicense = "BSD-2-Clause AND BSD-3-Clause AND MIT".toSpdx(), declaredLicenses = setOf("BSD-3-Clause", "MIT OR GPL-2.0-only"), description = "A package with all supported attributes set, with a VCS URL containing a user " + - "name, and with two scan results for the VCS containing copyright findings matched to a " + - "license finding.", + "name, and with two scan results for the VCS containing copyright findings matched to a " + + "license finding.", homepageUrl = "first package's homepage URL", sourceArtifact = RemoteArtifact( url = "https://some-host/first-package-sources.jar", @@ -272,7 +272,7 @@ private val ortResult = OrtResult( declaredLicenses = setOf("LicenseRef-scancode-philips-proprietary-notice-2000"), concludedLicense = "LicenseRef-scancode-purdue-bsd".toSpdx(), description = "A package used only from the excluded 'test' scope, with non-SPDX license IDs in " + - "the declared and concluded license.", + "the declared and concluded license.", homepageUrl = "", sourceArtifact = RemoteArtifact.EMPTY, vcs = VcsInfo.EMPTY diff --git a/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentReporter.kt b/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentReporter.kt index 5f1a638e2531..65cab073cdad 100644 --- a/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentReporter.kt +++ b/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentReporter.kt @@ -86,9 +86,9 @@ class SpdxDocumentReporter : Reporter { if (licenseRefExceptions.isNotEmpty()) { logger.warn { "The SPDX document contains the following ${licenseRefExceptions.size} LicenseRef- exceptions " + - "used by a WITH operator, which does not conform with SPDX specification version 2: \n" + - "finding ${licenseRefExceptions.joinToString("\n")}\n You may be able to use " - "license curations to fix up these exceptions into valid SPDX v2 license expressions." + "used by a WITH operator, which does not conform with SPDX specification version 2: \n" + + "finding ${licenseRefExceptions.joinToString("\n")}\n You may be able to use " + "license curations to fix up these exceptions into valid SPDX v2 license expressions." } } diff --git a/plugins/reporters/static-html/src/main/kotlin/StaticHtmlReporter.kt b/plugins/reporters/static-html/src/main/kotlin/StaticHtmlReporter.kt index 3948deada5d3..11b4407cceb6 100644 --- a/plugins/reporters/static-html/src/main/kotlin/StaticHtmlReporter.kt +++ b/plugins/reporters/static-html/src/main/kotlin/StaticHtmlReporter.kt @@ -726,9 +726,9 @@ private fun ResolvedLicenseLocation.permalink(id: Identifier): String? { return with(id) { val group = namespace.replace('.', '/') "https://repository.sonatype.org/" + - "service/local/repositories/central-proxy/" + - "archive/$group/$name/$version/$name-$version-sources.jar/" + - "!/${location.path}" + "service/local/repositories/central-proxy/" + + "archive/$group/$name/$version/$name-$version-sources.jar/" + + "!/${location.path}" } } } diff --git a/plugins/scanners/fossid/src/main/kotlin/FossId.kt b/plugins/scanners/fossid/src/main/kotlin/FossId.kt index 4fbdc96ba804..949aa9da6e8c 100644 --- a/plugins/scanners/fossid/src/main/kotlin/FossId.kt +++ b/plugins/scanners/fossid/src/main/kotlin/FossId.kt @@ -234,10 +234,10 @@ class FossId internal constructor( */ private fun createSingleIssueSummary(startTime: Instant, endTime: Instant = Instant.now(), issue: Issue) = ScanSummary.EMPTY.copy( - startTime = startTime, - endTime = endTime, - issues = listOf(issue) - ) + startTime = startTime, + endTime = endTime, + issues = listOf(issue) + ) override fun scanPackage(pkg: Package, context: ScanContext): ScanResult { val (result, duration) = measureTimedValue { @@ -251,7 +251,7 @@ class FossId internal constructor( val issue = createAndLogIssue( source = name, message = "Package '${pkg.id.toCoordinates()}' uses VCS type '${pkg.vcsProcessed.type}', but " + - "only ${VcsType.GIT} is supported.", + "only ${VcsType.GIT} is supported.", severity = Severity.WARNING ) @@ -272,7 +272,7 @@ class FossId internal constructor( val issue = createAndLogIssue( source = name, message = "Ignoring package '${pkg.id.toCoordinates()}' from '${pkg.vcsProcessed.url}' as it has " + - "path '${pkg.vcsProcessed.path}' set and scanning cannot be limited to paths.", + "path '${pkg.vcsProcessed.path}' set and scanning cannot be limited to paths.", severity = Severity.WARNING ) val provenance = RepositoryProvenance(pkg.vcsProcessed, pkg.vcsProcessed.revision) @@ -316,7 +316,7 @@ class FossId internal constructor( val issue = createAndLogIssue( source = name, message = "Package '${pkg.id.toCoordinates()}' has been scanned in asynchronous mode. " + - "Scan results need to be inspected on the server instance.", + "Scan results need to be inspected on the server instance.", severity = Severity.HINT ) val summary = createSingleIssueSummary(startTime, issue = issue) @@ -377,7 +377,7 @@ class FossId internal constructor( ScanStatus.QUEUED -> { logger.warn { "Found a previous scan which is still running. Will ignore the 'waitForResult' option and " + - "wait..." + "wait..." } waitScanComplete(scanCode) true diff --git a/plugins/scanners/fossid/src/main/kotlin/FossIdNamingProvider.kt b/plugins/scanners/fossid/src/main/kotlin/FossIdNamingProvider.kt index 9842bb1615d7..f55c63df1861 100644 --- a/plugins/scanners/fossid/src/main/kotlin/FossIdNamingProvider.kt +++ b/plugins/scanners/fossid/src/main/kotlin/FossIdNamingProvider.kt @@ -50,11 +50,11 @@ internal class FossIdNamingProvider( fun createProjectCode(projectName: String): String = namingProjectPattern?.let { - val builtins = mapOf( - "#projectName" to projectName - ) - replaceNamingConventionVariables(namingProjectPattern, builtins, namingConventionVariables) - } ?: projectName + val builtins = mapOf( + "#projectName" to projectName + ) + replaceNamingConventionVariables(namingProjectPattern, builtins, namingConventionVariables) + } ?: projectName fun createScanCode(projectName: String, deltaTag: FossId.DeltaTag? = null, branch: String = ""): String { var defaultPattern = "#projectName_#currentTimestamp" diff --git a/plugins/scanners/fossid/src/main/kotlin/FossIdScanResults.kt b/plugins/scanners/fossid/src/main/kotlin/FossIdScanResults.kt index 96e26b85047d..e7b6623315a4 100644 --- a/plugins/scanners/fossid/src/main/kotlin/FossIdScanResults.kt +++ b/plugins/scanners/fossid/src/main/kotlin/FossIdScanResults.kt @@ -90,7 +90,7 @@ internal fun List.mapSummary( issues += FossId.createAndLogIssue( source = "FossId", message = "Failed to parse license '${it.identifier}' as an SPDX expression: " + - spdxException.collectMessages() + spdxException.collectMessages() ) } } diff --git a/plugins/scanners/fossid/src/main/kotlin/Utils.kt b/plugins/scanners/fossid/src/main/kotlin/Utils.kt index 0a738e3f998a..e58473a56e12 100644 --- a/plugins/scanners/fossid/src/main/kotlin/Utils.kt +++ b/plugins/scanners/fossid/src/main/kotlin/Utils.kt @@ -85,12 +85,12 @@ internal fun List.filterLegacyRules( issues: MutableList ): List = rulesToTest.filterNot { ruleToTest -> - any { it.value == ruleToTest.value && it.type == ruleToTest.type } -}.onEach { - issues += Issue( - source = "FossID.compare", - message = "Rule '${it.value}' with type '${it.type}' is not present in the .ort.yml path excludes. " + + any { it.value == ruleToTest.value && it.type == ruleToTest.type } + }.onEach { + issues += Issue( + source = "FossID.compare", + message = "Rule '${it.value}' with type '${it.type}' is not present in the .ort.yml path excludes. " + "Add it to the .ort.yml file or remove it from the FossID scan.", - severity = Severity.HINT - ) -} + severity = Severity.HINT + ) + } diff --git a/plugins/scanners/fossid/src/test/kotlin/FossIdLicenseMappingTest.kt b/plugins/scanners/fossid/src/test/kotlin/FossIdLicenseMappingTest.kt index ca6482555193..e868f9623606 100644 --- a/plugins/scanners/fossid/src/test/kotlin/FossIdLicenseMappingTest.kt +++ b/plugins/scanners/fossid/src/test/kotlin/FossIdLicenseMappingTest.kt @@ -93,7 +93,7 @@ class FossIdLicenseMappingTest : WordSpec({ issues should haveSize(1) issues.first() shouldNotBeNull { message shouldStartWith - "Failed to map license 'invalid license' as an SPDX expression." + "Failed to map license 'invalid license' as an SPDX expression." severity shouldBe Severity.HINT } findings should haveSize(1) diff --git a/plugins/scanners/fossid/src/test/kotlin/FossIdTest.kt b/plugins/scanners/fossid/src/test/kotlin/FossIdTest.kt index 2dba89985e7d..a64f8807404b 100644 --- a/plugins/scanners/fossid/src/test/kotlin/FossIdTest.kt +++ b/plugins/scanners/fossid/src/test/kotlin/FossIdTest.kt @@ -219,9 +219,9 @@ class FossIdTest : WordSpec({ .expectDeleteScan(scanCode) coEvery { service.downloadFromGit(USER, API_KEY, scanCode) } returns - EntityResponseBody(status = 1) + EntityResponseBody(status = 1) coEvery { service.checkDownloadStatus(USER, API_KEY, scanCode) } returns - EntityResponseBody(status = 1, data = DownloadStatus.FAILED) + EntityResponseBody(status = 1, data = DownloadStatus.FAILED) val fossId = createFossId(config) fossId.scan(createPackage(createIdentifier(index = 1), vcsInfo)) @@ -435,7 +435,7 @@ class FossIdTest : WordSpec({ .expectDownload(scanCode) .mockFiles(scanCode) coEvery { service.createProject(USER, API_KEY, projectCode, projectCode) } returns - MapResponseBody(status = 1, data = mapOf()) + MapResponseBody(status = 1, data = mapOf()) val fossId = createFossId(config) @@ -1381,56 +1381,56 @@ private fun createPendingFile(index: Int): String = "/pending/file/$index" */ private fun createSnippet(index: Int): Snippet = Snippet( - index, - "created$index", - index, - index, - index, - MatchType.PARTIAL, - "reason$index", - "author$index", - "artifact$index", - "version$index", - null, - "MIT", - null, - "releaseDate$index", - "mirror$index", - "file$index", - "fileLicense$index", - "url$index", - "hits$index", - index, - "updated$index", - "cpe$index", - "$index", - "matchField$index", - "classification$index", - "highlighting$index" -) + index, + "created$index", + index, + index, + index, + MatchType.PARTIAL, + "reason$index", + "author$index", + "artifact$index", + "version$index", + null, + "MIT", + null, + "releaseDate$index", + "mirror$index", + "file$index", + "fileLicense$index", + "url$index", + "hits$index", + index, + "updated$index", + "cpe$index", + "$index", + "matchField$index", + "classification$index", + "highlighting$index" + ) /** * Generate a ORT snippet finding based on the given [index]. */ private fun createSnippetFindings(index: Int): Set = (1..5).map { snippetIndex -> - SnippetFinding( - TextLocation("/pending/file/$index", TextLocation.UNKNOWN_LINE), - OrtSnippet( - snippetIndex.toFloat(), - TextLocation("file$snippetIndex", TextLocation.UNKNOWN_LINE), - ArtifactProvenance(RemoteArtifact("url$snippetIndex", Hash.NONE)), - "pkg:generic/author$snippetIndex/artifact$snippetIndex@version$snippetIndex", - SpdxExpression.Companion.parse("MIT"), - mapOf( - FossId.SNIPPET_DATA_ID to "$snippetIndex", - FossId.SNIPPET_DATA_RELEASE_DATE to "releaseDate$snippetIndex", - FossId.SNIPPET_DATA_MATCH_TYPE to MatchType.PARTIAL.toString(), - FossId.SNIPPET_DATA_MATCH_TYPE to MatchType.PARTIAL.toString() + SnippetFinding( + TextLocation("/pending/file/$index", TextLocation.UNKNOWN_LINE), + OrtSnippet( + snippetIndex.toFloat(), + TextLocation("file$snippetIndex", TextLocation.UNKNOWN_LINE), + ArtifactProvenance(RemoteArtifact("url$snippetIndex", Hash.NONE)), + "pkg:generic/author$snippetIndex/artifact$snippetIndex@version$snippetIndex", + SpdxExpression.Companion.parse("MIT"), + mapOf( + FossId.SNIPPET_DATA_ID to "$snippetIndex", + FossId.SNIPPET_DATA_RELEASE_DATE to "releaseDate$snippetIndex", + FossId.SNIPPET_DATA_MATCH_TYPE to MatchType.PARTIAL.toString(), + FossId.SNIPPET_DATA_MATCH_TYPE to MatchType.PARTIAL.toString() + ) ) ) - ) -}.toSet() + }.toSet() /** * Prepare this service mock to answer a request for a project with the given [projectCode]. Return a response with @@ -1442,7 +1442,7 @@ private fun FossIdServiceWithVersion.expectProjectRequest( error: String? = null ): FossIdServiceWithVersion { coEvery { getProject(USER, API_KEY, projectCode) } returns - EntityResponseBody(status = status, error = error, data = mockk()) + EntityResponseBody(status = status, error = error, data = mockk()) return this } @@ -1464,7 +1464,7 @@ private fun FossIdServiceWithVersion.expectCheckScanStatus( */ private fun FossIdServiceWithVersion.expectListScans(projectCode: String, scans: List): FossIdServiceWithVersion { coEvery { listScansForProject(USER, API_KEY, projectCode) } returns - PolymorphicResponseBody(status = 1, data = PolymorphicList(scans)) + PolymorphicResponseBody(status = 1, data = PolymorphicList(scans)) return this } @@ -1476,7 +1476,7 @@ private fun FossIdServiceWithVersion.expectListIgnoreRules( rules: List ): FossIdServiceWithVersion { coEvery { listIgnoreRules(USER, API_KEY, scanCode) } returns - PolymorphicResponseBody(status = 1, data = PolymorphicList(rules)) + PolymorphicResponseBody(status = 1, data = PolymorphicList(rules)) return this } @@ -1502,9 +1502,9 @@ private fun FossIdServiceWithVersion.expectCreateIgnoreRule( */ private fun FossIdServiceWithVersion.expectDownload(scanCode: String): FossIdServiceWithVersion { coEvery { downloadFromGit(USER, API_KEY, scanCode) } returns - EntityResponseBody(status = 1) + EntityResponseBody(status = 1) coEvery { checkDownloadStatus(USER, API_KEY, scanCode) } returns - EntityResponseBody(status = 1, data = DownloadStatus.FINISHED) + EntityResponseBody(status = 1, data = DownloadStatus.FINISHED) return this } @@ -1555,22 +1555,22 @@ private fun FossIdServiceWithVersion.mockFiles( val matchedLines = MatchedLines(PolymorphicList(listOf(1, 2, 3, 21, 22, 36)), PolymorphicList(listOf(11, 12))) coEvery { listIdentifiedFiles(USER, API_KEY, scanCode) } returns - PolymorphicResponseBody( - status = 1, data = PolymorphicList(identifiedFiles) - ) + PolymorphicResponseBody( + status = 1, data = PolymorphicList(identifiedFiles) + ) coEvery { listMarkedAsIdentifiedFiles(USER, API_KEY, scanCode) } returns - PolymorphicResponseBody( - status = 1, data = PolymorphicList(markedFiles) - ) + PolymorphicResponseBody( + status = 1, data = PolymorphicList(markedFiles) + ) coEvery { listIgnoredFiles(USER, API_KEY, scanCode) } returns - PolymorphicResponseBody(status = 1, data = PolymorphicList(ignoredFiles)) + PolymorphicResponseBody(status = 1, data = PolymorphicList(ignoredFiles)) coEvery { listPendingFiles(USER, API_KEY, scanCode) } returns - PolymorphicResponseBody(status = 1, data = PolymorphicList(pendingFiles)) + PolymorphicResponseBody(status = 1, data = PolymorphicList(pendingFiles)) coEvery { listSnippets(USER, API_KEY, scanCode, any()) } returns - PolymorphicResponseBody(status = 1, data = PolymorphicList(snippets)) + PolymorphicResponseBody(status = 1, data = PolymorphicList(snippets)) if (matchedLinesFlag) { coEvery { listMatchedLines(USER, API_KEY, scanCode, any(), any()) } returns - EntityResponseBody(status = 1, data = matchedLines) + EntityResponseBody(status = 1, data = matchedLines) } return this diff --git a/plugins/scanners/fossid/src/test/kotlin/FossIdUrlProviderTest.kt b/plugins/scanners/fossid/src/test/kotlin/FossIdUrlProviderTest.kt index 23f67ee059da..0ba75afd5d2d 100644 --- a/plugins/scanners/fossid/src/test/kotlin/FossIdUrlProviderTest.kt +++ b/plugins/scanners/fossid/src/test/kotlin/FossIdUrlProviderTest.kt @@ -126,7 +126,7 @@ private val AUTHENTICATION = PasswordAuthentication(USER, PASSWORD.toCharArray() /** A URL mapping that adds credentials to arbitrary URLs. */ private const val ADD_CREDENTIALS_MAPPING = "(?)://(?)(?:\\d+)?(?.*) -> " + - "\${scheme}://#username:#password@\${host}\${port}\${path}" + "\${scheme}://#username:#password@\${host}\${port}\${path}" /** * Mock a request for authentication for the given [host] and [port] to return the specified diff --git a/plugins/scanners/fossid/src/test/kotlin/LegacyRulesTest.kt b/plugins/scanners/fossid/src/test/kotlin/LegacyRulesTest.kt index a7c6d3af296f..abc703ec9224 100644 --- a/plugins/scanners/fossid/src/test/kotlin/LegacyRulesTest.kt +++ b/plugins/scanners/fossid/src/test/kotlin/LegacyRulesTest.kt @@ -48,7 +48,7 @@ class LegacyRulesTest : WordSpec({ issues shouldHaveSize 1 issues.first().shouldNotBeNull { message shouldBe "Rule '.pdf' with type '${RuleType.EXTENSION}' is not present in the .ort.yml path" + - " excludes. Add it to the .ort.yml file or remove it from the FossID scan." + " excludes. Add it to the .ort.yml file or remove it from the FossID scan." severity shouldBe Severity.HINT } legacyRules shouldHaveSize 1 diff --git a/plugins/scanners/scancode/src/main/kotlin/ScanCode.kt b/plugins/scanners/scancode/src/main/kotlin/ScanCode.kt index c3a33c8ebb38..bd9c539fe136 100644 --- a/plugins/scanners/scancode/src/main/kotlin/ScanCode.kt +++ b/plugins/scanners/scancode/src/main/kotlin/ScanCode.kt @@ -177,10 +177,10 @@ class ScanCode internal constructor( */ internal fun runScanCode(path: File, resultFile: File) = ProcessCapture( - command(), - *commandLineOptions.toTypedArray(), - path.absolutePath, - OUTPUT_FORMAT_OPTION, - resultFile.absolutePath - ) + command(), + *commandLineOptions.toTypedArray(), + path.absolutePath, + OUTPUT_FORMAT_OPTION, + resultFile.absolutePath + ) } diff --git a/plugins/scanners/scancode/src/main/kotlin/ScanCodeErrorMappers.kt b/plugins/scanners/scancode/src/main/kotlin/ScanCodeErrorMappers.kt index bde6e056fe6d..d03f9eb54cf8 100644 --- a/plugins/scanners/scancode/src/main/kotlin/ScanCodeErrorMappers.kt +++ b/plugins/scanners/scancode/src/main/kotlin/ScanCodeErrorMappers.kt @@ -24,13 +24,13 @@ import org.ossreviewtoolkit.model.Issue // Note: The "(File: ...)" part in the patterns below is actually added by our own getRawResult() function. private val UNKNOWN_ERROR_REGEX = Regex( "(ERROR: for scanner: (?\\w+):\n)?" + - "ERROR: Unknown error:\n.+\n(?\\w+Error)(:|\n)(?.*) \\(File: (?.+)\\)", + "ERROR: Unknown error:\n.+\n(?\\w+Error)(:|\n)(?.*) \\(File: (?.+)\\)", RegexOption.DOT_MATCHES_ALL ) private val TIMEOUT_ERROR_REGEX = Regex( "(ERROR: for scanner: (?\\w+):\n)?" + - "ERROR: Processing interrupted: timeout after (?\\d+) seconds. \\(File: (?.+)\\)" + "ERROR: Processing interrupted: timeout after (?\\d+) seconds. \\(File: (?.+)\\)" ) /** diff --git a/plugins/scanners/scancode/src/main/kotlin/ScanCodeResultParser.kt b/plugins/scanners/scancode/src/main/kotlin/ScanCodeResultParser.kt index 77adb9a74dd5..29f9d70e80c6 100644 --- a/plugins/scanners/scancode/src/main/kotlin/ScanCodeResultParser.kt +++ b/plugins/scanners/scancode/src/main/kotlin/ScanCodeResultParser.kt @@ -111,7 +111,7 @@ fun ScanCodeResult.toScanSummary(): ScanSummary { issues += ScanCode.createAndLogIssue( source = ScanCode.SCANNER_NAME, message = "The output format version $outputFormatVersion exceeds the supported major version " + - "$MAX_SUPPORTED_OUTPUT_FORMAT_MAJOR_VERSION. Results may be incomplete or incorrect.", + "$MAX_SUPPORTED_OUTPUT_FORMAT_MAJOR_VERSION. Results may be incomplete or incorrect.", severity = Severity.WARNING ) } @@ -131,11 +131,11 @@ fun ScanCodeResult.toScanSummary(): ScanSummary { // ScanCode creates separate license entries for each license in an expression. Deduplicate these by grouping by // the same expression. val licenses = file.licenses.groupBy { - LicenseMatch(it.matchedRule.licenseExpression, it.startLine, it.endLine, it.score) - }.map { - // Arbitrarily take the first of the duplicate license entries. - it.value.first() - } + LicenseMatch(it.matchedRule.licenseExpression, it.startLine, it.endLine, it.score) + }.map { + // Arbitrarily take the first of the duplicate license entries. + it.value.first() + } licenses.mapTo(licenseFindings) { license -> // ScanCode uses its own license keys as identifiers in license expressions. diff --git a/plugins/scanners/scancode/src/test/kotlin/ScanCodeResultParserTest.kt b/plugins/scanners/scancode/src/test/kotlin/ScanCodeResultParserTest.kt index 16ed84dab4a8..44473c731e53 100644 --- a/plugins/scanners/scancode/src/test/kotlin/ScanCodeResultParserTest.kt +++ b/plugins/scanners/scancode/src/test/kotlin/ScanCodeResultParserTest.kt @@ -108,13 +108,13 @@ class ScanCodeResultParserTest : FreeSpec({ summary should containCopyrightsExactly( "Copyright (c) 2014 Jonathan Ong" to - listOf(TextLocation("index.js", 3)), + listOf(TextLocation("index.js", 3)), "Copyright (c) 2014 Jonathan Ong " to - listOf(TextLocation("LICENSE", 3)), + listOf(TextLocation("LICENSE", 3)), "Copyright (c) 2015 Douglas Christopher Wilson" to - listOf(TextLocation("index.js", 4)), + listOf(TextLocation("index.js", 4)), "Copyright (c) 2015 Douglas Christopher Wilson " to - listOf(TextLocation("LICENSE", 4)) + listOf(TextLocation("LICENSE", 4)) ) } } @@ -156,7 +156,7 @@ class ScanCodeResultParserTest : FreeSpec({ timestamp = Instant.EPOCH, source = ScanCode.SCANNER_NAME, message = "The output format version 3.0.0 exceeds the supported major version " + - "$MAX_SUPPORTED_OUTPUT_FORMAT_MAJOR_VERSION. Results may be incomplete or incorrect.", + "$MAX_SUPPORTED_OUTPUT_FORMAT_MAJOR_VERSION. Results may be incomplete or incorrect.", severity = Severity.WARNING ) } diff --git a/plugins/scanners/scancode/src/test/kotlin/ScanCodeTest.kt b/plugins/scanners/scancode/src/test/kotlin/ScanCodeTest.kt index 187ed0f76ae4..1eb6e9128bf9 100644 --- a/plugins/scanners/scancode/src/test/kotlin/ScanCodeTest.kt +++ b/plugins/scanners/scancode/src/test/kotlin/ScanCodeTest.kt @@ -66,7 +66,7 @@ class ScanCodeTest : WordSpec({ "commandLineOptions" should { "contain the default values if the scanner configuration is empty" { scanner.commandLineOptions.joinToString(" ") shouldMatch - "--copyright --license --info --strip-root --timeout 300 --processes \\d+" + "--copyright --license --info --strip-root --timeout 300 --processes \\d+" } "contain the values from the scanner configuration" { @@ -83,7 +83,7 @@ class ScanCodeTest : WordSpec({ ) scannerWithConfig.commandLineOptions.joinToString(" ") shouldBe - "--command --line --commandLineNonConfig" + "--command --line --commandLineNonConfig" } "be handled correctly when containing multiple spaces" { diff --git a/reporter/src/main/kotlin/ReportTableModel.kt b/reporter/src/main/kotlin/ReportTableModel.kt index a1b4d9fc3203..9a074ea40e47 100644 --- a/reporter/src/main/kotlin/ReportTableModel.kt +++ b/reporter/src/main/kotlin/ReportTableModel.kt @@ -216,7 +216,7 @@ data class ReportTableModel( init { val unresolvedIssues = rows.flatMap { it.analyzerIssues.flatMap { (_, issues) -> issues } + - it.scanIssues.flatMap { (_, issues) -> issues } + it.scanIssues.flatMap { (_, issues) -> issues } }.filterNot { it.isResolved }.groupBy { it.severity } errorCount = unresolvedIssues[Severity.ERROR].orEmpty().size diff --git a/reporter/src/main/kotlin/ReportTableModelMapper.kt b/reporter/src/main/kotlin/ReportTableModelMapper.kt index 9b93b00bdf7c..d0cef4b97cab 100644 --- a/reporter/src/main/kotlin/ReportTableModelMapper.kt +++ b/reporter/src/main/kotlin/ReportTableModelMapper.kt @@ -103,7 +103,7 @@ object ReportTableModelMapper { scanIssues = scanIssues.map { it.toResolvableIssue(resolutionProvider, howToFixTextProvider) } ).also { row -> val isRowExcluded = pathExcludes.isNotEmpty() - || (row.scopes.isNotEmpty() && row.scopes.all { it.value.isNotEmpty() }) + || (row.scopes.isNotEmpty() && row.scopes.all { it.value.isNotEmpty() }) val nonExcludedAnalyzerIssues = if (isRowExcluded) emptyList() else row.analyzerIssues val nonExcludedScanIssues = if (isRowExcluded) emptyList() else row.scanIssues diff --git a/scanner/src/funTest/kotlin/provenance/DefaultNestedProvenanceResolverFunTest.kt b/scanner/src/funTest/kotlin/provenance/DefaultNestedProvenanceResolverFunTest.kt index 8d513800a92c..995873826f2a 100644 --- a/scanner/src/funTest/kotlin/provenance/DefaultNestedProvenanceResolverFunTest.kt +++ b/scanner/src/funTest/kotlin/provenance/DefaultNestedProvenanceResolverFunTest.kt @@ -56,7 +56,7 @@ class DefaultNestedProvenanceResolverFunTest : WordSpec() { ) resolver.resolveNestedProvenance(provenance) shouldBe - NestedProvenance(root = provenance, subRepositories = emptyMap()) + NestedProvenance(root = provenance, subRepositories = emptyMap()) } } @@ -72,7 +72,7 @@ class DefaultNestedProvenanceResolverFunTest : WordSpec() { ) resolver.resolveNestedProvenance(provenance) shouldBe - NestedProvenance(root = provenance, subRepositories = emptyMap()) + NestedProvenance(root = provenance, subRepositories = emptyMap()) } "find recursive Git submodules" { @@ -200,7 +200,7 @@ class DefaultNestedProvenanceResolverFunTest : WordSpec() { shouldThrow { resolver.resolveNestedProvenance(provenance) shouldBe - NestedProvenance(root = provenance, subRepositories = emptyMap()) + NestedProvenance(root = provenance, subRepositories = emptyMap()) } } @@ -215,7 +215,7 @@ class DefaultNestedProvenanceResolverFunTest : WordSpec() { ) resolver.resolveNestedProvenance(provenance) shouldBe - NestedProvenance(root = provenance, subRepositories = emptyMap()) + NestedProvenance(root = provenance, subRepositories = emptyMap()) } } } diff --git a/scanner/src/funTest/kotlin/provenance/DefaultPackageProvenanceResolverFunTest.kt b/scanner/src/funTest/kotlin/provenance/DefaultPackageProvenanceResolverFunTest.kt index 757453d433a9..c64551128a53 100644 --- a/scanner/src/funTest/kotlin/provenance/DefaultPackageProvenanceResolverFunTest.kt +++ b/scanner/src/funTest/kotlin/provenance/DefaultPackageProvenanceResolverFunTest.kt @@ -60,7 +60,7 @@ class DefaultPackageProvenanceResolverFunTest : WordSpec() { ) resolver.resolveProvenance(pkg, listOf(SourceCodeOrigin.ARTIFACT)) shouldBe - ArtifactProvenance(pkg.sourceArtifact) + ArtifactProvenance(pkg.sourceArtifact) } "fail if the artifact does not exist" { @@ -86,10 +86,10 @@ class DefaultPackageProvenanceResolverFunTest : WordSpec() { ) resolver.resolveProvenance(pkg, listOf(SourceCodeOrigin.VCS)) shouldBe - RepositoryProvenance( - vcsInfo = pkg.vcsProcessed, - resolvedRevision = "ad0367b7b9920144a47b8d30cc0c84cea102b821" - ) + RepositoryProvenance( + vcsInfo = pkg.vcsProcessed, + resolvedRevision = "ad0367b7b9920144a47b8d30cc0c84cea102b821" + ) } "resolve a tag name to a commit" { @@ -102,10 +102,10 @@ class DefaultPackageProvenanceResolverFunTest : WordSpec() { ) resolver.resolveProvenance(pkg, listOf(SourceCodeOrigin.VCS)) shouldBe - RepositoryProvenance( - vcsInfo = pkg.vcsProcessed, - resolvedRevision = "ad0367b7b9920144a47b8d30cc0c84cea102b821" - ) + RepositoryProvenance( + vcsInfo = pkg.vcsProcessed, + resolvedRevision = "ad0367b7b9920144a47b8d30cc0c84cea102b821" + ) } "fail if the revision does not exist" { @@ -131,10 +131,10 @@ class DefaultPackageProvenanceResolverFunTest : WordSpec() { ) resolver.resolveProvenance(pkg, listOf(SourceCodeOrigin.VCS)) shouldBe - RepositoryProvenance( - vcsInfo = pkg.vcsProcessed, - resolvedRevision = "ad0367b7b9920144a47b8d30cc0c84cea102b821" - ) + RepositoryProvenance( + vcsInfo = pkg.vcsProcessed, + resolvedRevision = "ad0367b7b9920144a47b8d30cc0c84cea102b821" + ) } "work for Subversion tags" { @@ -148,10 +148,10 @@ class DefaultPackageProvenanceResolverFunTest : WordSpec() { ) resolver.resolveProvenance(pkg, listOf(SourceCodeOrigin.VCS)) shouldBe - RepositoryProvenance( - vcsInfo = pkg.vcsProcessed, - resolvedRevision = "380970" - ) + RepositoryProvenance( + vcsInfo = pkg.vcsProcessed, + resolvedRevision = "380970" + ) } } @@ -170,13 +170,13 @@ class DefaultPackageProvenanceResolverFunTest : WordSpec() { ) resolver.resolveProvenance(pkg, listOf(SourceCodeOrigin.ARTIFACT, SourceCodeOrigin.VCS)) shouldBe - ArtifactProvenance(pkg.sourceArtifact) + ArtifactProvenance(pkg.sourceArtifact) resolver.resolveProvenance(pkg, listOf(SourceCodeOrigin.VCS, SourceCodeOrigin.ARTIFACT)) shouldBe - RepositoryProvenance( - vcsInfo = pkg.vcsProcessed, - resolvedRevision = "ad0367b7b9920144a47b8d30cc0c84cea102b821" - ) + RepositoryProvenance( + vcsInfo = pkg.vcsProcessed, + resolvedRevision = "ad0367b7b9920144a47b8d30cc0c84cea102b821" + ) } "try all provided source code origins" { @@ -188,7 +188,7 @@ class DefaultPackageProvenanceResolverFunTest : WordSpec() { ) resolver.resolveProvenance(pkg, listOf(SourceCodeOrigin.VCS, SourceCodeOrigin.ARTIFACT)) shouldBe - ArtifactProvenance(pkg.sourceArtifact) + ArtifactProvenance(pkg.sourceArtifact) } } } diff --git a/scanner/src/funTest/kotlin/scanners/ScannerIntegrationFunTest.kt b/scanner/src/funTest/kotlin/scanners/ScannerIntegrationFunTest.kt index 758b50707a40..83726fb2cc7c 100644 --- a/scanner/src/funTest/kotlin/scanners/ScannerIntegrationFunTest.kt +++ b/scanner/src/funTest/kotlin/scanners/ScannerIntegrationFunTest.kt @@ -67,7 +67,7 @@ class ScannerIntegrationFunTest : WordSpec({ val expectedResultFile = getAssetFile("scanner-integration-all-pkgs-expected-ort-result.yml") patchActualResult(ortResult.toYaml(), patchStartAndEndTime = true) should - matchExpectedResult(expectedResultFile) + matchExpectedResult(expectedResultFile) } "return the expected (merged) scan results" { @@ -76,7 +76,7 @@ class ScannerIntegrationFunTest : WordSpec({ val scanResults = ortResult.getScanResults().toSortedMap() patchActualResult(scanResults.toYaml(), patchStartAndEndTime = true) should - matchExpectedResult(expectedResultFile) + matchExpectedResult(expectedResultFile) } "return the expected (merged) file lists" { @@ -96,7 +96,7 @@ class ScannerIntegrationFunTest : WordSpec({ val ortResult = createScanner().scan(analyzerResult, skipExcluded = false, emptyMap()) patchActualResult(ortResult.toYaml(), patchStartAndEndTime = true) should - matchExpectedResult(expectedResultFile) + matchExpectedResult(expectedResultFile) } } }) diff --git a/scanner/src/funTest/kotlin/storages/AbstractProvenanceBasedStorageFunTest.kt b/scanner/src/funTest/kotlin/storages/AbstractProvenanceBasedStorageFunTest.kt index 06feb8055c89..fb73241044d3 100644 --- a/scanner/src/funTest/kotlin/storages/AbstractProvenanceBasedStorageFunTest.kt +++ b/scanner/src/funTest/kotlin/storages/AbstractProvenanceBasedStorageFunTest.kt @@ -221,11 +221,11 @@ private fun createScanResult( scannerDetails: ScannerDetails = createScannerDetails(), license: String = "Apache-2.0" ) = ScanResult( - provenance, - scannerDetails, - ScanSummary.EMPTY.copy( - licenseFindings = setOf( - LicenseFinding(license, TextLocation("file.txt", 1, 2)) - ) + provenance, + scannerDetails, + ScanSummary.EMPTY.copy( + licenseFindings = setOf( + LicenseFinding(license, TextLocation("file.txt", 1, 2)) ) ) +) diff --git a/scanner/src/funTest/kotlin/storages/ClearlyDefinedStorageFunTest.kt b/scanner/src/funTest/kotlin/storages/ClearlyDefinedStorageFunTest.kt index e0a390f5f96d..335f93a82d11 100644 --- a/scanner/src/funTest/kotlin/storages/ClearlyDefinedStorageFunTest.kt +++ b/scanner/src/funTest/kotlin/storages/ClearlyDefinedStorageFunTest.kt @@ -58,7 +58,7 @@ class ClearlyDefinedStorageFunTest : StringSpec({ provenance = ArtifactProvenance( sourceArtifact = RemoteArtifact( url = "https://search.maven.org/remotecontent" + - "?filepath=com/vdurmont/semver4j/3.1.0/semver4j-3.1.0-sources.jar", + "?filepath=com/vdurmont/semver4j/3.1.0/semver4j-3.1.0-sources.jar", hash = Hash( value = "0de1248f09dfe8df3b021c84e0642ee222cceb13", algorithm = HashAlgorithm.SHA1 @@ -69,10 +69,10 @@ class ClearlyDefinedStorageFunTest : StringSpec({ name = "ScanCode", version = "3.0.2", configuration = "input /tmp/cd-2rGiCR --classify true --copyright true --email true " + - "--generated true --info true --is-license-text true --json-pp /tmp/cd-0EjTZ7 " + - "--license true --license-clarity-score true --license-diag true --license-text true " + - "--package true --processes 2 --strip-root true --summary true --summary-key-files " + - "true --timeout 1000.0 --url true" + "--generated true --info true --is-license-text true --json-pp /tmp/cd-0EjTZ7 " + + "--license true --license-clarity-score true --license-diag true --license-text true " + + "--package true --processes 2 --strip-root true --summary true --summary-key-files " + + "true --timeout 1000.0 --url true" ), summary = ScanSummary.EMPTY.copy( startTime = Instant.parse("2020-02-14T00:36:14.000335513Z"), @@ -114,10 +114,10 @@ class ClearlyDefinedStorageFunTest : StringSpec({ name = "ScanCode", version = "30.1.0", configuration = "input /tmp/cd-5bxzho --classify true --copyright true --email true " + - "--generated true --info true --is-license-text true --json-pp /tmp/cd-ZLZNNN " + - "--license true --license-clarity-score true --license-text true " + - "--license-text-diagnostics true --package true --processes 2 --strip-root true " + - "--summary true --summary-key-files true --timeout 1000.0 --url true" + "--generated true --info true --is-license-text true --json-pp /tmp/cd-ZLZNNN " + + "--license true --license-clarity-score true --license-text true " + + "--license-text-diagnostics true --package true --processes 2 --strip-root true " + + "--summary true --summary-key-files true --timeout 1000.0 --url true" ), summary = ScanSummary.EMPTY.copy( startTime = Instant.parse("2022-05-02T07:34:28.000784295Z"), diff --git a/scanner/src/main/kotlin/ScanResultsStorage.kt b/scanner/src/main/kotlin/ScanResultsStorage.kt index ae6dfba48c94..920b8e5ae625 100644 --- a/scanner/src/main/kotlin/ScanResultsStorage.kt +++ b/scanner/src/main/kotlin/ScanResultsStorage.kt @@ -64,7 +64,7 @@ abstract class ScanResultsStorage : PackageBasedScanStorage { result.onSuccess { results -> logger.info { "Read ${results.size} scan result(s) for '${id.toCoordinates()}' from ${javaClass.simpleName} in " + - "$duration." + "$duration." } } @@ -85,7 +85,7 @@ abstract class ScanResultsStorage : PackageBasedScanStorage { result.onSuccess { results -> logger.info { "Read ${results.size} scan result(s) for '${pkg.id.toCoordinates()}' from ${javaClass.simpleName} in " + - "$duration." + "$duration." } } @@ -160,7 +160,7 @@ abstract class ScanResultsStorage : PackageBasedScanStorage { if (scanResults.isEmpty()) { logger.debug { "No stored scan results found for $pkg. The following entries with non-matching provenance " + - "have been ignored: ${scanResults.map { it.provenance }}" + "have been ignored: ${scanResults.map { it.provenance }}" } } else { // Only keep scan results from compatible scanners. @@ -168,7 +168,7 @@ abstract class ScanResultsStorage : PackageBasedScanStorage { if (scanResults.isEmpty()) { logger.debug { "No stored scan results found for $scannerCriteria. The following entries with " + - "incompatible scanners have been ignored: ${scanResults.map { it.scanner }}" + "incompatible scanners have been ignored: ${scanResults.map { it.scanner }}" } } } diff --git a/scanner/src/main/kotlin/ScanStorages.kt b/scanner/src/main/kotlin/ScanStorages.kt index 052bf6f43df9..b7f5671251b3 100644 --- a/scanner/src/main/kotlin/ScanStorages.kt +++ b/scanner/src/main/kotlin/ScanStorages.kt @@ -64,8 +64,8 @@ class ScanStorages( fun resolve(name: String): ScanStorage = requireNotNull(storages[name]) { - "Could not resolve storage '$name'." - } + "Could not resolve storage '$name'." + } val defaultStorage by lazy { createDefaultStorage() } diff --git a/scanner/src/main/kotlin/Scanner.kt b/scanner/src/main/kotlin/Scanner.kt index 50646418288f..3a2ccfdc6fdf 100644 --- a/scanner/src/main/kotlin/Scanner.kt +++ b/scanner/src/main/kotlin/Scanner.kt @@ -302,7 +302,7 @@ class Scanner( Issue( source = TOOL_NAME, message = "Could not resolve nested provenance for package " + - "'${id.toCoordinates()}': ${it.collectMessages()}" + "'${id.toCoordinates()}': ${it.collectMessages()}" ) ) } @@ -328,7 +328,7 @@ class Scanner( if (!hasNestedProvenance) { logger.debug { "Skipping scan of '${pkg.id.toCoordinates()}' with package scanner '${scanner.name}' as " + - "no nested provenance for the package could be resolved." + "no nested provenance for the package could be resolved." } } @@ -336,7 +336,7 @@ class Scanner( if (hasCompleteScanResult) { logger.debug { "Skipping scan of '${pkg.id.toCoordinates()}' with package scanner '${scanner.name}' as " + - "stored results are available." + "stored results are available." } } @@ -365,7 +365,7 @@ class Scanner( val packageIds = packagesWithIncompleteScanResult.drop(1) .joinToString("\n") { "\t${it.id.toCoordinates()}" } "Scanning package '${referencePackage.id.toCoordinates()}' as reference for these packages " + - "with the same provenance:\n$packageIds" + "with the same provenance:\n$packageIds" } } @@ -407,7 +407,7 @@ class Scanner( if (controller.hasScanResult(scanner, provenance)) { logger.debug { "Skipping $provenance scan (${index + 1} of ${provenances.size}) with provenance scanner " + - "'${scanner.name}' as a result is already available." + "'${scanner.name}' as a result is already available." } return@scanner @@ -415,7 +415,7 @@ class Scanner( logger.info { "Scanning $provenance (${index + 1} of ${provenances.size}) with provenance scanner " + - "'${scanner.name}'." + "'${scanner.name}'." } // Filter the scan context to hide the excludes from scanner with scan criteria. @@ -498,7 +498,7 @@ class Scanner( private fun readStoredResults(controller: ScanController) { logger.info { "Reading stored scan results for ${controller.getPackageProvenancesWithoutVcsPath().size} package(s) " + - "with ${controller.getAllProvenances().size} provenance(s)." + "with ${controller.getAllProvenances().size} provenance(s)." } val readDuration = measureTime { @@ -538,7 +538,7 @@ class Scanner( logger.warn { "Could not read scan result for '${pkg.id.toCoordinates()}' from " + - "${reader.javaClass.simpleName}: ${e.collectMessages()}" + "${reader.javaClass.simpleName}: ${e.collectMessages()}" } } } @@ -563,7 +563,7 @@ class Scanner( logger.warn { "Could not read scan result for $provenance from ${reader.javaClass.simpleName}: " + - e.collectMessages() + e.collectMessages() } } } @@ -644,7 +644,7 @@ class Scanner( logger.warn { "Could not write scan result for $provenance to ${writer.javaClass.simpleName}: " + - e.collectMessages() + e.collectMessages() } } } @@ -659,7 +659,7 @@ class Scanner( logger.warn { "Could not write scan result for '${pkg.id.toCoordinates()}' to ${writer.javaClass.simpleName}: " + - e.collectMessages() + e.collectMessages() } } } @@ -689,7 +689,7 @@ class Scanner( Issue( source = "Downloader", message = "Could not create file list for " + - "'${id.toCoordinates()}': ${it.collectMessages()}" + "'${id.toCoordinates()}': ${it.collectMessages()}" ) ) } @@ -735,7 +735,7 @@ class Scanner( Issue( source = "Downloader", message = "Could not create file archive for " + - "'${pkg.id.toCoordinates()}': ${it.collectMessages()}" + "'${pkg.id.toCoordinates()}': ${it.collectMessages()}" ) ) } diff --git a/scanner/src/main/kotlin/provenance/FileBasedNestedProvenanceStorage.kt b/scanner/src/main/kotlin/provenance/FileBasedNestedProvenanceStorage.kt index 855d3fa2a922..0cac16ea543b 100644 --- a/scanner/src/main/kotlin/provenance/FileBasedNestedProvenanceStorage.kt +++ b/scanner/src/main/kotlin/provenance/FileBasedNestedProvenanceStorage.kt @@ -56,7 +56,7 @@ class FileBasedNestedProvenanceStorage(private val backend: FileStorage) : Neste else -> { logger.info { "Could not read resolved nested provenances for '$root' from path '$path': " + - it.collectMessages() + it.collectMessages() } emptyList() @@ -84,7 +84,7 @@ class FileBasedNestedProvenanceStorage(private val backend: FileStorage) : Neste logger.warn { "Could not store resolved nested provenance for '$root' at path '$path': " + - it.collectMessages() + it.collectMessages() } } else -> throw it @@ -97,6 +97,6 @@ private const val FILE_NAME = "resolved_nested_provenance.yml" private fun storagePath(root: RepositoryProvenance) = "${root.vcsInfo.type.toString().fileSystemEncode()}/" + - "${root.vcsInfo.url.fileSystemEncode()}/" + - "${root.resolvedRevision.fileSystemEncode()}/" + - FILE_NAME + "${root.vcsInfo.url.fileSystemEncode()}/" + + "${root.resolvedRevision.fileSystemEncode()}/" + + FILE_NAME diff --git a/scanner/src/main/kotlin/provenance/FileBasedPackageProvenanceStorage.kt b/scanner/src/main/kotlin/provenance/FileBasedPackageProvenanceStorage.kt index c80e997fb3da..2a420af8feea 100644 --- a/scanner/src/main/kotlin/provenance/FileBasedPackageProvenanceStorage.kt +++ b/scanner/src/main/kotlin/provenance/FileBasedPackageProvenanceStorage.kt @@ -64,7 +64,7 @@ class FileBasedPackageProvenanceStorage(val backend: FileStorage) : PackageProve else -> { logger.info { "Could not read resolved provenances for '${id.toCoordinates()}' from path '$path': " + - it.collectMessages() + it.collectMessages() } emptyList() @@ -107,7 +107,7 @@ class FileBasedPackageProvenanceStorage(val backend: FileStorage) : PackageProve logger.warn { "Could not store resolved provenances for '${id.toCoordinates()}' at path '$path': " + - it.collectMessages() + it.collectMessages() } } else -> throw it diff --git a/scanner/src/main/kotlin/provenance/NestedProvenanceResolver.kt b/scanner/src/main/kotlin/provenance/NestedProvenanceResolver.kt index aa39fcd347a9..1dd48236b874 100644 --- a/scanner/src/main/kotlin/provenance/NestedProvenanceResolver.kt +++ b/scanner/src/main/kotlin/provenance/NestedProvenanceResolver.kt @@ -70,7 +70,7 @@ class DefaultNestedProvenanceResolver( } else { logger.info { "Found a stored nested provenance for $provenance with at least one non-fixed revision, " + - "restarting resolution." + "restarting resolution." } } } else { diff --git a/scanner/src/main/kotlin/provenance/NestedProvenanceScanResult.kt b/scanner/src/main/kotlin/provenance/NestedProvenanceScanResult.kt index 7b56ad91b1dc..a66819cadf10 100644 --- a/scanner/src/main/kotlin/provenance/NestedProvenanceScanResult.kt +++ b/scanner/src/main/kotlin/provenance/NestedProvenanceScanResult.kt @@ -90,8 +90,8 @@ data class NestedProvenanceScanResult( require(provenancesWithVcsPath.isEmpty()) { "Cannot filter scan results by VCS path that have a repository provenance with a non-blank VCS path " + - "because their partial scan result might not contain the path to filter for. The following " + - "provenances have a non-blank VCS path: ${provenancesWithVcsPath.joinToString("\n") { "\t$it" }}." + "because their partial scan result might not contain the path to filter for. The following " + + "provenances have a non-blank VCS path: ${provenancesWithVcsPath.joinToString("\n") { "\t$it" }}." } val pathsWithinProvenances = provenances.filter { @@ -99,7 +99,7 @@ data class NestedProvenanceScanResult( // Return true if the provenance is on the same branch as the filter path. Otherwise it can be discarded, // because all findings would be filtered anyway. provenancePath.isEmpty() || provenancePath == path || provenancePath.startsWith("$path/") || - path.startsWith("$provenancePath/") + path.startsWith("$provenancePath/") }.associateWith { provenance -> val provenancePath = getPath(provenance) diff --git a/scanner/src/main/kotlin/provenance/PackageProvenanceResolver.kt b/scanner/src/main/kotlin/provenance/PackageProvenanceResolver.kt index 25c77c33fd6e..c67fc67e50b7 100644 --- a/scanner/src/main/kotlin/provenance/PackageProvenanceResolver.kt +++ b/scanner/src/main/kotlin/provenance/PackageProvenanceResolver.kt @@ -100,7 +100,7 @@ class DefaultPackageProvenanceResolver( val message = buildString { append( "Could not resolve provenance for package '${pkg.id.toCoordinates()}' for source code origins " + - "$sourceCodeOriginPriority." + "$sourceCodeOriginPriority." ) errors.forEach { (origin, throwable) -> @@ -126,14 +126,14 @@ class DefaultPackageProvenanceResolver( is UnresolvedPackageProvenance -> { logger.info { "Found a stored artifact resolution for package '${pkg.id.toCoordinates()}' which failed " + - "previously, re-attempting resolution. The error was: ${storedResult.message}" + "previously, re-attempting resolution. The error was: ${storedResult.message}" } } else -> { logger.info { "Could not find a stored artifact resolution result for package '${pkg.id.toCoordinates()}', " + - "attempting resolution." + "attempting resolution." } } } @@ -150,7 +150,7 @@ class DefaultPackageProvenanceResolver( throw IOException( "Could not verify existence of source artifact at ${pkg.sourceArtifact.url}. " + - "HTTP request got response $responseCode." + "HTTP request got response $responseCode." ) } @@ -176,17 +176,17 @@ class DefaultPackageProvenanceResolver( if (storedResult.isFixedRevision) { logger.info { "Found a stored repository resolution for package '${pkg.id.toCoordinates()}' with the fixed " + - "revision ${storedResult.clonedRevision} which was resolved to " + - "${storedResult.provenance.resolvedRevision}." + "revision ${storedResult.clonedRevision} which was resolved to " + + "${storedResult.provenance.resolvedRevision}." } return storedResult.provenance } else { logger.info { "Found a stored repository resolution result for package '${pkg.id.toCoordinates()}' with " + - "the non-fixed revision ${storedResult.clonedRevision} which was resolved to " + - "${storedResult.provenance.resolvedRevision}. Restarting resolution of the " + - "non-fixed revision." + "the non-fixed revision ${storedResult.clonedRevision} which was resolved to " + + "${storedResult.provenance.resolvedRevision}. Restarting resolution of the " + + "non-fixed revision." } } } @@ -194,14 +194,14 @@ class DefaultPackageProvenanceResolver( is UnresolvedPackageProvenance -> { logger.info { "Found a stored repository resolution result for package '${pkg.id.toCoordinates()}' which " + - "failed previously, re-attempting resolution. The error was: ${storedResult.message}" + "failed previously, re-attempting resolution. The error was: ${storedResult.message}" } } else -> { logger.info { "Could not find a stored repository resolution result for package '${pkg.id.toCoordinates()}', " + - "attempting resolution." + "attempting resolution." } } } @@ -220,7 +220,7 @@ class DefaultPackageProvenanceResolver( if (revisionCandidates.isEmpty()) { addAndLogMessage( "Could not find any revision candidates for package '${pkg.id.toCoordinates()}' with " + - "${pkg.vcsProcessed}." + "${pkg.vcsProcessed}." ) } @@ -233,7 +233,7 @@ class DefaultPackageProvenanceResolver( ) { addAndLogMessage( "Discarding revision '$revision' because the requested VCS path '${pkg.vcsProcessed.path}' " + - "does not exist." + "does not exist." ) return@forEachIndexed @@ -248,7 +248,7 @@ class DefaultPackageProvenanceResolver( logger.info { "Resolved revision for package '${pkg.id.toCoordinates()}' to $resolvedRevision based on " + - "guessed revision $revision." + "guessed revision $revision." } val repositoryProvenance = RepositoryProvenance(pkg.vcsProcessed, workingTree.getRevision()) @@ -265,7 +265,7 @@ class DefaultPackageProvenanceResolver( } val message = "Could not resolve revision for package '${pkg.id.toCoordinates()}' with " + - "${pkg.vcsProcessed}:\n${messages.joinToString("\n") { "\t$it" }}" + "${pkg.vcsProcessed}:\n${messages.joinToString("\n") { "\t$it" }}" storage.putProvenance(pkg.id, pkg.vcsProcessed, UnresolvedPackageProvenance(message)) diff --git a/scanner/src/main/kotlin/provenance/PostgresNestedProvenanceStorage.kt b/scanner/src/main/kotlin/provenance/PostgresNestedProvenanceStorage.kt index 78bb94129cdb..e20276949798 100644 --- a/scanner/src/main/kotlin/provenance/PostgresNestedProvenanceStorage.kt +++ b/scanner/src/main/kotlin/provenance/PostgresNestedProvenanceStorage.kt @@ -68,8 +68,8 @@ class PostgresNestedProvenanceStorage( database.transaction { table.select { table.vcsType eq root.vcsInfo.type.toString() and - (table.vcsUrl eq root.vcsInfo.url) and - (table.vcsRevision eq root.resolvedRevision) + (table.vcsUrl eq root.vcsInfo.url) and + (table.vcsRevision eq root.resolvedRevision) }.map { it[table.result] }.find { it.nestedProvenance.root == root } } @@ -77,8 +77,8 @@ class PostgresNestedProvenanceStorage( database.transaction { val idsToRemove = table.select { table.vcsType eq root.vcsInfo.type.toString() and - (table.vcsUrl eq root.vcsInfo.url) and - (table.vcsRevision eq root.resolvedRevision) + (table.vcsUrl eq root.vcsInfo.url) and + (table.vcsRevision eq root.resolvedRevision) }.filter { it[table.result].nestedProvenance.root == root }.map { it[table.id].value } table.deleteWhere { table.id inList idsToRemove } diff --git a/scanner/src/main/kotlin/provenance/PostgresPackageProvenanceStorage.kt b/scanner/src/main/kotlin/provenance/PostgresPackageProvenanceStorage.kt index bd513de214e3..346ad9d5337f 100644 --- a/scanner/src/main/kotlin/provenance/PostgresPackageProvenanceStorage.kt +++ b/scanner/src/main/kotlin/provenance/PostgresPackageProvenanceStorage.kt @@ -70,8 +70,8 @@ class PostgresPackageProvenanceStorage( database.transaction { table.select { table.identifier eq id.toCoordinates() and - (table.artifactUrl eq sourceArtifact.url) and - (table.artifactHash eq sourceArtifact.hash.value) + (table.artifactUrl eq sourceArtifact.url) and + (table.artifactHash eq sourceArtifact.hash.value) }.map { it[table.result] }.firstOrNull() } @@ -79,10 +79,10 @@ class PostgresPackageProvenanceStorage( database.transaction { table.select { table.identifier eq id.toCoordinates() and - (table.vcsType eq vcs.type.toString()) and - (table.vcsUrl eq vcs.url) and - (table.vcsRevision eq vcs.revision) and - (table.vcsPath eq vcs.path) + (table.vcsType eq vcs.type.toString()) and + (table.vcsUrl eq vcs.url) and + (table.vcsRevision eq vcs.revision) and + (table.vcsPath eq vcs.path) }.map { it[table.result] }.firstOrNull() } @@ -101,8 +101,8 @@ class PostgresPackageProvenanceStorage( database.transaction { table.deleteWhere { table.identifier eq id.toCoordinates() and - (table.artifactUrl eq sourceArtifact.url) and - (table.artifactHash eq sourceArtifact.hash.value) + (table.artifactUrl eq sourceArtifact.url) and + (table.artifactHash eq sourceArtifact.hash.value) } table.insert { @@ -118,10 +118,10 @@ class PostgresPackageProvenanceStorage( database.transaction { table.deleteWhere { table.identifier eq id.toCoordinates() and - (table.vcsType eq vcs.type.toString()) and - (table.vcsUrl eq vcs.url) and - (table.vcsRevision eq vcs.revision) and - (table.vcsPath eq vcs.path) + (table.vcsType eq vcs.type.toString()) and + (table.vcsUrl eq vcs.url) and + (table.vcsRevision eq vcs.revision) and + (table.vcsPath eq vcs.path) } table.insert { diff --git a/scanner/src/main/kotlin/storages/ClearlyDefinedStorage.kt b/scanner/src/main/kotlin/storages/ClearlyDefinedStorage.kt index 40125d1105cf..dae4ebb1fd40 100644 --- a/scanner/src/main/kotlin/storages/ClearlyDefinedStorage.kt +++ b/scanner/src/main/kotlin/storages/ClearlyDefinedStorage.kt @@ -171,7 +171,7 @@ class ClearlyDefinedStorage( e.showStackTrace() val message = "Error when reading results for '${pkg.id.toCoordinates()}' from ClearlyDefined: " + - e.collectMessages() + e.collectMessages() logger.error { message } diff --git a/scanner/src/main/kotlin/storages/FileBasedStorage.kt b/scanner/src/main/kotlin/storages/FileBasedStorage.kt index fee7c690df9d..5e78789a12c9 100644 --- a/scanner/src/main/kotlin/storages/FileBasedStorage.kt +++ b/scanner/src/main/kotlin/storages/FileBasedStorage.kt @@ -63,7 +63,7 @@ class FileBasedStorage( if (it is FileNotFoundException) return EMPTY_RESULT val message = "Could not read scan results for '${id.toCoordinates()}' from path '$path': " + - it.collectMessages() + it.collectMessages() logger.info { message } @@ -76,7 +76,7 @@ class FileBasedStorage( if (existingScanResults.any { it.scanner == scanResult.scanner && it.provenance == scanResult.provenance }) { val message = "Did not store scan result for '${id.toCoordinates()}' because a scan result for the same " + - "scanner and provenance was already stored." + "scanner and provenance was already stored." logger.warn { message } @@ -97,7 +97,7 @@ class FileBasedStorage( it.showStackTrace() val message = "Could not store scan result for '${id.toCoordinates()}' at path '$path': " + - it.collectMessages() + it.collectMessages() logger.warn { message } diff --git a/scanner/src/main/kotlin/storages/PostgresStorage.kt b/scanner/src/main/kotlin/storages/PostgresStorage.kt index 62725560351f..50d1291b56d0 100644 --- a/scanner/src/main/kotlin/storages/PostgresStorage.kt +++ b/scanner/src/main/kotlin/storages/PostgresStorage.kt @@ -141,7 +141,7 @@ class PostgresStorage( it.showStackTrace() val message = "Could not read scan results for '${id.toCoordinates()}' from database: " + - it.collectMessages() + it.collectMessages() logger.info { message } @@ -157,9 +157,9 @@ class PostgresStorage( database.transaction { ScanResultDao.find { (ScanResults.identifier eq pkg.id.toCoordinates()) and - (rawParam("scan_result->'scanner'->>'name'") tilde scannerCriteria.regScannerName) and - (rawParam(VERSION_EXPRESSION) greaterEq arrayParam(minVersionArray)) and - (rawParam(VERSION_EXPRESSION) less arrayParam(maxVersionArray)) + (rawParam("scan_result->'scanner'->>'name'") tilde scannerCriteria.regScannerName) and + (rawParam(VERSION_EXPRESSION) greaterEq arrayParam(minVersionArray)) and + (rawParam(VERSION_EXPRESSION) less arrayParam(maxVersionArray)) }.map { it.scanResult } // TODO: Currently the query only accounts for the scanner criteria. Ideally also the provenance // should be checked in the query to reduce the downloaded data. @@ -173,7 +173,7 @@ class PostgresStorage( it.showStackTrace() val message = "Could not read scan results for '${pkg.id.toCoordinates()}' with " + - "$scannerCriteria from database: ${it.collectMessages()}" + "$scannerCriteria from database: ${it.collectMessages()}" logger.info { message } @@ -198,9 +198,9 @@ class PostgresStorage( @Suppress("MaxLineLength") ScanResultDao.find { (ScanResults.identifier inList chunk.map { it.id.toCoordinates() }) and - (rawParam("scan_result->'scanner'->>'name'") tilde scannerCriteria.regScannerName) and - (rawParam(VERSION_EXPRESSION) greaterEq arrayParam(minVersionArray)) and - (rawParam(VERSION_EXPRESSION) less arrayParam(maxVersionArray)) + (rawParam("scan_result->'scanner'->>'name'") tilde scannerCriteria.regScannerName) and + (rawParam(VERSION_EXPRESSION) greaterEq arrayParam(minVersionArray)) and + (rawParam(VERSION_EXPRESSION) less arrayParam(maxVersionArray)) }.map { it.identifier to it.scanResult } } }.flatMap { it.await() } @@ -223,7 +223,7 @@ class PostgresStorage( it.showStackTrace() val message = "Could not read scan results with $scannerCriteria from database: " + - it.collectMessages() + it.collectMessages() logger.info { message } diff --git a/scanner/src/main/kotlin/storages/ProvenanceBasedFileStorage.kt b/scanner/src/main/kotlin/storages/ProvenanceBasedFileStorage.kt index 6faa33a0d282..e738c194fe8a 100644 --- a/scanner/src/main/kotlin/storages/ProvenanceBasedFileStorage.kt +++ b/scanner/src/main/kotlin/storages/ProvenanceBasedFileStorage.kt @@ -65,7 +65,7 @@ class ProvenanceBasedFileStorage(private val backend: FileStorage) : ProvenanceB else -> { logger.info { "Could not read scan results for '$provenance' from path '$path': " + - it.collectMessages() + it.collectMessages() } // TODO: Propagate error. @@ -121,9 +121,9 @@ private fun storagePath(provenance: KnownProvenance) = is ArtifactProvenance -> "artifact/${provenance.sourceArtifact.url.fileSystemEncode()}/$SCAN_RESULTS_FILE_NAME" is RepositoryProvenance -> { "repository/${provenance.vcsInfo.type.toString().fileSystemEncode()}" + - "/${provenance.vcsInfo.url.fileSystemEncode()}" + - "/${provenance.resolvedRevision.fileSystemEncode()}" + - "/$SCAN_RESULTS_FILE_NAME" + "/${provenance.vcsInfo.url.fileSystemEncode()}" + + "/${provenance.resolvedRevision.fileSystemEncode()}" + + "/$SCAN_RESULTS_FILE_NAME" } } @@ -134,8 +134,8 @@ private fun ScanResult.matches(other: ScanResult): Boolean { return scanner == other.scanner && when { thisProvenance is RepositoryProvenance && otherProvenance is RepositoryProvenance -> { thisProvenance.vcsInfo.type == otherProvenance.vcsInfo.type && - thisProvenance.vcsInfo.url == otherProvenance.vcsInfo.url && - thisProvenance.resolvedRevision == otherProvenance.resolvedRevision + thisProvenance.vcsInfo.url == otherProvenance.vcsInfo.url && + thisProvenance.resolvedRevision == otherProvenance.resolvedRevision } else -> provenance == otherProvenance diff --git a/scanner/src/main/kotlin/storages/ProvenanceBasedPostgresStorage.kt b/scanner/src/main/kotlin/storages/ProvenanceBasedPostgresStorage.kt index 41bc5300857c..b02c30b8f2e3 100644 --- a/scanner/src/main/kotlin/storages/ProvenanceBasedPostgresStorage.kt +++ b/scanner/src/main/kotlin/storages/ProvenanceBasedPostgresStorage.kt @@ -90,15 +90,15 @@ class ProvenanceBasedPostgresStorage( is ArtifactProvenance -> { query.andWhere { table.artifactUrl eq provenance.sourceArtifact.url and - (table.artifactHash eq provenance.sourceArtifact.hash.value) + (table.artifactHash eq provenance.sourceArtifact.hash.value) } } is RepositoryProvenance -> { query.andWhere { table.vcsType eq provenance.vcsInfo.type.toString() and - (table.vcsUrl eq provenance.vcsInfo.url) and - (table.vcsRevision eq provenance.resolvedRevision) + (table.vcsUrl eq provenance.vcsInfo.url) and + (table.vcsRevision eq provenance.resolvedRevision) } } } diff --git a/scanner/src/main/kotlin/storages/Sw360Storage.kt b/scanner/src/main/kotlin/storages/Sw360Storage.kt index e01a55f69d1c..f1f39fadabfc 100644 --- a/scanner/src/main/kotlin/storages/Sw360Storage.kt +++ b/scanner/src/main/kotlin/storages/Sw360Storage.kt @@ -128,7 +128,7 @@ class Sw360Storage( } }.recoverCatching { val message = "Failed to add scan results for '${id.toCoordinates()}' to SW360: " + - it.collectMessages() + it.collectMessages() logger.info { message } @@ -156,7 +156,7 @@ class Sw360Storage( private fun isAttachmentAScanResult(attachment: SW360SparseAttachment) = attachment.attachmentType == SW360AttachmentType.SCAN_RESULT_REPORT - && attachment.filename == SCAN_RESULTS_FILE_NAME + && attachment.filename == SCAN_RESULTS_FILE_NAME private fun createReleaseName(id: Identifier) = "${id.namespace}/${id.name}" diff --git a/scanner/src/test/kotlin/ScannerTest.kt b/scanner/src/test/kotlin/ScannerTest.kt index 52e33344ccc3..3189de38944f 100644 --- a/scanner/src/test/kotlin/ScannerTest.kt +++ b/scanner/src/test/kotlin/ScannerTest.kt @@ -90,15 +90,15 @@ class ScannerTest : WordSpec({ scanner.scan(setOf(pkgWithArtifact), packageContext) .getAllScanResults()[pkgWithArtifact.id] shouldNotBeNull { - this shouldNot beEmpty() - forEach { it.scanner.name shouldBe "package scanner" } - } + this shouldNot beEmpty() + forEach { it.scanner.name shouldBe "package scanner" } + } scanner.scan(setOf(pkgWithArtifact), projectContext) .getAllScanResults()[pkgWithArtifact.id] shouldNotBeNull { - this shouldNot beEmpty() - forEach { it.scanner.name shouldBe "project scanner" } - } + this shouldNot beEmpty() + forEach { it.scanner.name shouldBe "project scanner" } + } } "Not scan projects if no scanner wrapper for projects is configured" { @@ -132,9 +132,9 @@ class ScannerTest : WordSpec({ val scannerWrapper = spyk(FakePackageScannerWrapper()) { every { scanPackage(pkgWithArtifact, any()) } returns - createScanResult(pkgWithArtifact.artifactProvenance(), details) + createScanResult(pkgWithArtifact.artifactProvenance(), details) every { scanPackage(pkgWithVcs, any()) } returns - createScanResult(pkgWithVcs.repositoryProvenance(), details) + createScanResult(pkgWithVcs.repositoryProvenance(), details) } val scanner = createScanner(packageScannerWrappers = listOf(scannerWrapper)) @@ -425,9 +425,9 @@ class ScannerTest : WordSpec({ val nestedProvenanceResolver = spyk(FakeNestedProvenanceResolver()) { every { resolveNestedProvenance(pkgCompletelyScanned.repositoryProvenance()) } returns - nestedProvenanceCompletelyScanned + nestedProvenanceCompletelyScanned every { resolveNestedProvenance(pkgPartlyScanned.repositoryProvenance()) } returns - nestedProvenancePartlyScanned + nestedProvenancePartlyScanned } val reader = spyk(FakePackageBasedStorageReader(scannerWrapper.details)) { @@ -566,9 +566,9 @@ class ScannerTest : WordSpec({ val nestedProvenanceResolver = spyk(FakeNestedProvenanceResolver()) { every { resolveNestedProvenance(pkgCompletelyScanned.repositoryProvenance()) } returns - nestedProvenanceCompletelyScanned + nestedProvenanceCompletelyScanned every { resolveNestedProvenance(pkgPartlyScanned.repositoryProvenance()) } returns - nestedProvenancePartlyScanned + nestedProvenancePartlyScanned } val reader = spyk(FakeProvenanceBasedStorageReader(scannerWrapper.details)) { @@ -935,18 +935,18 @@ private fun createScanner( packageScannerWrappers: List = emptyList(), projectScannerWrappers: List = emptyList() ) = Scanner( - ScannerConfiguration(archive = FileArchiverConfiguration(enabled = false)), - DownloaderConfiguration(), - provenanceDownloader, - storageReaders, - storageWriters, - packageProvenanceResolver, - nestedProvenanceResolver, - mapOf( - PackageType.PROJECT to projectScannerWrappers, - PackageType.PACKAGE to packageScannerWrappers - ) + ScannerConfiguration(archive = FileArchiverConfiguration(enabled = false)), + DownloaderConfiguration(), + provenanceDownloader, + storageReaders, + storageWriters, + packageProvenanceResolver, + nestedProvenanceResolver, + mapOf( + PackageType.PROJECT to projectScannerWrappers, + PackageType.PACKAGE to packageScannerWrappers ) +) private fun Package.Companion.new(type: String = "", group: String = "", name: String = "", version: String = "") = EMPTY.copy(id = Identifier(type, group, name, version)) @@ -978,21 +978,21 @@ private fun createScanResult( LicenseFinding("Apache-2.0", TextLocation("${scannerDetails.name}.txt", 1, 2)) ) ) = ScanResult( - provenance, - scannerDetails, - ScanSummary.EMPTY.copy(licenseFindings = licenseFindings) - ) + provenance, + scannerDetails, + ScanSummary.EMPTY.copy(licenseFindings = licenseFindings) +) private fun createNestedScanResult( provenance: KnownProvenance, scannerDetails: ScannerDetails, subRepositories: Map = emptyMap() ) = NestedProvenanceScanResult( - NestedProvenance(root = provenance, subRepositories = subRepositories), - scanResults = mapOf( - provenance to listOf(createScanResult(provenance, scannerDetails)) - ) + subRepositories.values.associateWith { listOf(createScanResult(it, scannerDetails)) } - ) + NestedProvenance(root = provenance, subRepositories = subRepositories), + scanResults = mapOf( + provenance to listOf(createScanResult(provenance, scannerDetails)) + ) + subRepositories.values.associateWith { listOf(createScanResult(it, scannerDetails)) } +) private fun createStoredScanResult(provenance: Provenance, scannerDetails: ScannerDetails) = ScanResult( @@ -1010,8 +1010,8 @@ private fun createStoredNestedScanResult( scannerDetails: ScannerDetails, subRepositories: Map = emptyMap() ) = NestedProvenanceScanResult( - NestedProvenance(root = provenance, subRepositories = subRepositories), - scanResults = mapOf( - provenance to listOf(createStoredScanResult(provenance, scannerDetails)) - ) + subRepositories.values.associateWith { listOf(createStoredScanResult(it, scannerDetails)) } - ) + NestedProvenance(root = provenance, subRepositories = subRepositories), + scanResults = mapOf( + provenance to listOf(createStoredScanResult(provenance, scannerDetails)) + ) + subRepositories.values.associateWith { listOf(createStoredScanResult(it, scannerDetails)) } +) diff --git a/utils/common/src/main/kotlin/ArchiveUtils.kt b/utils/common/src/main/kotlin/ArchiveUtils.kt index 9d8fb16b8916..10f63c135c5b 100644 --- a/utils/common/src/main/kotlin/ArchiveUtils.kt +++ b/utils/common/src/main/kotlin/ArchiveUtils.kt @@ -84,20 +84,20 @@ fun File.unpack( forceArchiveType: ArchiveType = ArchiveType.NONE, filter: (ArchiveEntry) -> Boolean = { true } ) = when (forceArchiveType.takeUnless { it == ArchiveType.NONE } ?: ArchiveType.getType(name)) { - ArchiveType.SEVENZIP -> unpack7Zip(targetDirectory, filter) - ArchiveType.ZIP -> unpackZip(targetDirectory, filter) + ArchiveType.SEVENZIP -> unpack7Zip(targetDirectory, filter) + ArchiveType.ZIP -> unpackZip(targetDirectory, filter) - ArchiveType.TAR -> inputStream().use { it.unpackTar(targetDirectory, filter) } - ArchiveType.TAR_BZIP2 -> inputStream().use { BZip2CompressorInputStream(it).unpackTar(targetDirectory, filter) } - ArchiveType.TAR_GZIP -> inputStream().use { GzipCompressorInputStream(it).unpackTar(targetDirectory, filter) } - ArchiveType.TAR_XZ -> inputStream().use { XZCompressorInputStream(it).unpackTar(targetDirectory, filter) } + ArchiveType.TAR -> inputStream().use { it.unpackTar(targetDirectory, filter) } + ArchiveType.TAR_BZIP2 -> inputStream().use { BZip2CompressorInputStream(it).unpackTar(targetDirectory, filter) } + ArchiveType.TAR_GZIP -> inputStream().use { GzipCompressorInputStream(it).unpackTar(targetDirectory, filter) } + ArchiveType.TAR_XZ -> inputStream().use { XZCompressorInputStream(it).unpackTar(targetDirectory, filter) } - ArchiveType.DEB -> unpackDeb(targetDirectory, filter) + ArchiveType.DEB -> unpackDeb(targetDirectory, filter) - ArchiveType.NONE -> { - throw IOException("Unable to guess compression scheme from file name '$name'.") - } + ArchiveType.NONE -> { + throw IOException("Unable to guess compression scheme from file name '$name'.") } +} /** * Try to unpack this [File] of an unknown archive type to [targetDirectory] using [filter] to select only the entries @@ -273,41 +273,41 @@ private fun ArchiveInputStream.unpack( shouldSkip: (ArchiveEntry) -> Boolean, mode: (ArchiveEntry) -> Int ) = use { input -> - val canonicalTargetDirectory = targetDirectory.canonicalFile - var processed = false + val canonicalTargetDirectory = targetDirectory.canonicalFile + var processed = false - while (true) { - val entry = input.nextEntry ?: break - processed = true + while (true) { + val entry = input.nextEntry ?: break + processed = true - if (shouldSkip(entry)) continue + if (shouldSkip(entry)) continue - val target = targetDirectory.resolve(entry.name) + val target = targetDirectory.resolve(entry.name) - if (!target.canonicalFile.startsWith(canonicalTargetDirectory)) { - ArchiveUtils.logger.warn { - "Skipping entry '${entry.name}' which points to outside of '$targetDirectory'." - } - - continue + if (!target.canonicalFile.startsWith(canonicalTargetDirectory)) { + ArchiveUtils.logger.warn { + "Skipping entry '${entry.name}' which points to outside of '$targetDirectory'." } - // There is no guarantee that directory entries appear before file entries, so ensure that the parent - // directory for a file exists. - target.parentFile.safeMkdirs() + continue + } - target.outputStream().use { output -> - input.copyTo(output) - } + // There is no guarantee that directory entries appear before file entries, so ensure that the parent + // directory for a file exists. + target.parentFile.safeMkdirs() - copyExecutableModeBit(target, mode(entry)) + target.outputStream().use { output -> + input.copyTo(output) } - if (this is TarArchiveInputStream && !processed) { - throw IOException("Unsupported archive type or empty archive.") - } + copyExecutableModeBit(target, mode(entry)) } + if (this is TarArchiveInputStream && !processed) { + throw IOException("Unsupported archive type or empty archive.") + } +} + /** * Copy the executable bit contained in [mode] to the [target] file's mode bits. */ diff --git a/utils/common/src/main/kotlin/CommandLineTool.kt b/utils/common/src/main/kotlin/CommandLineTool.kt index b2a9d68a3fe8..d2983702d4d7 100644 --- a/utils/common/src/main/kotlin/CommandLineTool.kt +++ b/utils/common/src/main/kotlin/CommandLineTool.kt @@ -107,7 +107,7 @@ interface CommandLineTool { if (!actualVersion.satisfies(requiredVersion)) { logger.warn { "The command is required in version $requiredVersion, but you are using version $actualVersion. This " + - "could lead to problems." + "could lead to problems." } } } diff --git a/utils/common/src/main/kotlin/Extensions.kt b/utils/common/src/main/kotlin/Extensions.kt index a3c67300a48b..cfbb0255ced5 100644 --- a/utils/common/src/main/kotlin/Extensions.kt +++ b/utils/common/src/main/kotlin/Extensions.kt @@ -77,8 +77,8 @@ fun Collection.collapseToRanges(): List> { */ fun Collection>.prettyPrintRanges(): String = joinToString { (startValue, endValue) -> - if (startValue == endValue) startValue.toString() else "$startValue-$endValue" -} + if (startValue == endValue) startValue.toString() else "$startValue-$endValue" + } /** * Format this [Double] as a string with the provided number of [decimalPlaces]. diff --git a/utils/common/src/main/kotlin/PluginManager.kt b/utils/common/src/main/kotlin/PluginManager.kt index c42a700f86e8..7a42574b0828 100644 --- a/utils/common/src/main/kotlin/PluginManager.kt +++ b/utils/common/src/main/kotlin/PluginManager.kt @@ -36,11 +36,11 @@ interface Plugin { */ inline fun getAll() = getLoaderFor() - .iterator() - .asSequence() - .associateByTo(sortedMapOf(String.CASE_INSENSITIVE_ORDER)) { - it.type - } + .iterator() + .asSequence() + .associateByTo(sortedMapOf(String.CASE_INSENSITIVE_ORDER)) { + it.type + } } /** diff --git a/utils/common/src/main/kotlin/ProcessCapture.kt b/utils/common/src/main/kotlin/ProcessCapture.kt index b9eadd138279..ad5bebc85642 100644 --- a/utils/common/src/main/kotlin/ProcessCapture.kt +++ b/utils/common/src/main/kotlin/ProcessCapture.kt @@ -125,7 +125,7 @@ class ProcessCapture( } ?: stdout return "Running '$commandLine' in '$usedWorkingDir' failed with exit code $exitValue:\n" + - limitOutputLines(message) + limitOutputLines(message) } init { diff --git a/utils/common/src/test/kotlin/ExtensionsTest.kt b/utils/common/src/test/kotlin/ExtensionsTest.kt index b12bce08311c..58900ab7adeb 100644 --- a/utils/common/src/test/kotlin/ExtensionsTest.kt +++ b/utils/common/src/test/kotlin/ExtensionsTest.kt @@ -338,7 +338,7 @@ class ExtensionsTest : WordSpec({ "String.collapseWhitespace()" should { "remove additional white spaces" { "String with additional white spaces. ".collapseWhitespace() shouldBe - "String with additional white spaces." + "String with additional white spaces." } "remove newlines" { @@ -392,27 +392,27 @@ class ExtensionsTest : WordSpec({ "String.replaceCredentialsInUri" should { "strip the user name from a string representing a URL" { "ssh://bot@gerrit.host.com:29418/parent/project".replaceCredentialsInUri() shouldBe - "ssh://gerrit.host.com:29418/parent/project" + "ssh://gerrit.host.com:29418/parent/project" } "strip the user name and password from a string representing a URL" { "ssh://bot:pass@gerrit.host.com:29418/parent/project".replaceCredentialsInUri() shouldBe - "ssh://gerrit.host.com:29418/parent/project" + "ssh://gerrit.host.com:29418/parent/project" } "replace the user name from a string representing a URL" { "ssh://bot@gerrit.host.com:29418/parent/project".replaceCredentialsInUri("user") shouldBe - "ssh://user@gerrit.host.com:29418/parent/project" + "ssh://user@gerrit.host.com:29418/parent/project" } "replace the user name and password from a string representing a URL" { "ssh://bot:pass@gerrit.host.com:29418/parent/project".replaceCredentialsInUri("user:secret") shouldBe - "ssh://user:secret@gerrit.host.com:29418/parent/project" + "ssh://user:secret@gerrit.host.com:29418/parent/project" } "not modify encodings in a URL" { "ssh://bot@gerrit.host.com:29418/parent/project%20with%20spaces".replaceCredentialsInUri() shouldBe - "ssh://gerrit.host.com:29418/parent/project%20with%20spaces" + "ssh://gerrit.host.com:29418/parent/project%20with%20spaces" } "not modify a string not representing a URL" { @@ -473,20 +473,20 @@ class ExtensionsTest : WordSpec({ "URI.getQueryParameters" should { "return the query parameter for a simple query" { URI("https://oss-review-toolkit.org?key=value").getQueryParameters() shouldBe - mapOf("key" to listOf("value")) + mapOf("key" to listOf("value")) } "work with multiple query parameters" { URI("https://oss-review-toolkit.org?key1=value1&key2=value2").getQueryParameters() shouldBe - mapOf("key1" to listOf("value1"), "key2" to listOf("value2")) + mapOf("key1" to listOf("value1"), "key2" to listOf("value2")) } "return query parameter with multiple values" { URI("https://oss-review-toolkit.org?key=value1,value2,value3").getQueryParameters() shouldBe - mapOf("key" to listOf("value1", "value2", "value3")) + mapOf("key" to listOf("value1", "value2", "value3")) URI("https://oss-review-toolkit.org?key=value1&key=value2").getQueryParameters() shouldBe - mapOf("key" to listOf("value1", "value2")) + mapOf("key" to listOf("value1", "value2")) } "work for URIs without query parameters" { diff --git a/utils/ort/src/main/kotlin/Utils.kt b/utils/ort/src/main/kotlin/Utils.kt index 27e7b8b99806..52877d144fd2 100644 --- a/utils/ort/src/main/kotlin/Utils.kt +++ b/utils/ort/src/main/kotlin/Utils.kt @@ -120,12 +120,12 @@ fun filterVersionNames(version: String, names: List, project: String? = // Full match with the current version variant. last == null - // The prefix does not end with the current separators or a digit. - || (last !in currentSeparators && !last.isDigit()) - // The prefix ends with the current separators but the forelast character is not a digit. - || (last in currentSeparators && (forelast == null || !forelast.isDigit())) - // The prefix ends with 'v' and the forelast character is a separator. - || (last == 'v' && (forelast == null || forelast in currentSeparators)) + // The prefix does not end with the current separators or a digit. + || (last !in currentSeparators && !last.isDigit()) + // The prefix ends with the current separators but the forelast character is not a digit. + || (last in currentSeparators && (forelast == null || !forelast.isDigit())) + // The prefix ends with 'v' and the forelast character is a separator. + || (last == 'v' && (forelast == null || forelast in currentSeparators)) } ?: false hasIgnorableSuffixOnly || hasIgnorablePrefixOnly diff --git a/utils/ort/src/test/kotlin/UtilsTest.kt b/utils/ort/src/test/kotlin/UtilsTest.kt index 21b726ad98ff..e087a4b55216 100644 --- a/utils/ort/src/test/kotlin/UtilsTest.kt +++ b/utils/ort/src/test/kotlin/UtilsTest.kt @@ -263,11 +263,11 @@ class UtilsTest : WordSpec({ "handle anonymous Git / HTTPS URL schemes" { val packages = mapOf( "git://github.com/cheeriojs/cheerio.git" - to "https://github.com/cheeriojs/cheerio.git", + to "https://github.com/cheeriojs/cheerio.git", "git+https://github.com/fb55/boolbase.git" - to "https://github.com/fb55/boolbase.git", + to "https://github.com/fb55/boolbase.git", "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" - to "https://github.com/DefinitelyTyped/DefinitelyTyped.git" + to "https://github.com/DefinitelyTyped/DefinitelyTyped.git" ) packages.entries.forAll { (actualUrl, expectedUrl) -> @@ -278,11 +278,11 @@ class UtilsTest : WordSpec({ "handle authenticated SSH URL schemes" { val packages = mapOf( "git+ssh://git@github.com/logicalparadox/idris.git" - to "ssh://git@github.com/logicalparadox/idris.git", + to "ssh://git@github.com/logicalparadox/idris.git", "git@github.com:oss-review-toolkit/ort.git" - to "ssh://git@github.com/oss-review-toolkit/ort.git", + to "ssh://git@github.com/oss-review-toolkit/ort.git", "ssh://user@gerrit.server.com:29418/parent/project" - to "ssh://user@gerrit.server.com:29418/parent/project" + to "ssh://user@gerrit.server.com:29418/parent/project" ) packages.entries.forAll { (actualUrl, expectedUrl) -> @@ -293,7 +293,7 @@ class UtilsTest : WordSpec({ "add missing https:// for GitHub URLs" { val packages = mapOf( "github.com/leanovate/play-mockws" - to "https://github.com/leanovate/play-mockws.git" + to "https://github.com/leanovate/play-mockws.git" ) packages.entries.forAll { (actualUrl, expectedUrl) -> @@ -304,9 +304,9 @@ class UtilsTest : WordSpec({ "add missing .git for GitHub URLs" { val packages = mapOf( "https://github.com/fb55/nth-check" - to "https://github.com/fb55/nth-check.git", + to "https://github.com/fb55/nth-check.git", "git://github.com/isaacs/inherits" - to "https://github.com/isaacs/inherits.git" + to "https://github.com/isaacs/inherits.git" ) packages.entries.forAll { (actualUrl, expectedUrl) -> @@ -317,9 +317,9 @@ class UtilsTest : WordSpec({ "add missing git@ for GitHub SSH URLs" { val packages = mapOf( "ssh://github.com/heremaps/here-aaa-java-sdk.git" - to "ssh://git@github.com/heremaps/here-aaa-java-sdk.git", + to "ssh://git@github.com/heremaps/here-aaa-java-sdk.git", "ssh://github.com/heremaps/here-aaa-java-sdk" - to "ssh://git@github.com/heremaps/here-aaa-java-sdk.git" + to "ssh://git@github.com/heremaps/here-aaa-java-sdk.git" ) packages.entries.forAll { (actualUrl, expectedUrl) -> @@ -330,9 +330,9 @@ class UtilsTest : WordSpec({ "handle a trailing slash correctly" { val packages = mapOf( "https://github.com/kilian/electron-to-chromium/" - to "https://github.com/kilian/electron-to-chromium.git", + to "https://github.com/kilian/electron-to-chromium.git", "git://github.com/isaacs/inherits.git/" - to "https://github.com/isaacs/inherits.git" + to "https://github.com/isaacs/inherits.git" ) packages.entries.forAll { (actualUrl, expectedUrl) -> @@ -354,13 +354,13 @@ class UtilsTest : WordSpec({ val packages = mapOf( "relative/path/to/local/file" - to "file://$userDir/relative/path/to/local/file", + to "file://$userDir/relative/path/to/local/file", "relative/path/to/local/dir/" - to "file://$userDir/relative/path/to/local/dir", + to "file://$userDir/relative/path/to/local/dir", "/absolute/path/to/local/file" - to "file://${userRoot}absolute/path/to/local/file", + to "file://${userRoot}absolute/path/to/local/file", "/absolute/path/to/local/dir/" - to "file://${userRoot}absolute/path/to/local/dir" + to "file://${userRoot}absolute/path/to/local/dir" ) packages.entries.forAll { (actualUrl, expectedUrl) -> @@ -371,9 +371,9 @@ class UtilsTest : WordSpec({ "convert git to https for GitHub URLs" { val packages = mapOf( "git://github.com:ccavanaugh/jgnash.git" - to "https://github.com/ccavanaugh/jgnash.git", + to "https://github.com/ccavanaugh/jgnash.git", "git://github.com/netty/netty.git/netty-buffer" - to "https://github.com/netty/netty.git/netty-buffer" + to "https://github.com/netty/netty.git/netty-buffer" ) packages.entries.forAll { (actualUrl, expectedUrl) -> @@ -384,7 +384,7 @@ class UtilsTest : WordSpec({ "not strip svn+ prefix from Subversion URLs" { val packages = mapOf( "svn+ssh://svn.code.sf.net/p/stddecimal/code/trunk" - to "svn+ssh://svn.code.sf.net/p/stddecimal/code/trunk" + to "svn+ssh://svn.code.sf.net/p/stddecimal/code/trunk" ) packages.entries.forAll { (actualUrl, expectedUrl) -> @@ -395,9 +395,9 @@ class UtilsTest : WordSpec({ "fixup crazy URLs" { val packages = mapOf( "git@github.com/cisco/node-jose.git" - to "ssh://git@github.com/cisco/node-jose.git", + to "ssh://git@github.com/cisco/node-jose.git", "https://git@github.com:hacksparrow/node-easyimage.git" - to "https://github.com/hacksparrow/node-easyimage.git" + to "https://github.com/hacksparrow/node-easyimage.git" ) packages.entries.forAll { (actualUrl, expectedUrl) -> diff --git a/utils/spdx/src/main/kotlin/SpdxExpression.kt b/utils/spdx/src/main/kotlin/SpdxExpression.kt index 83a9806c9fa4..e1854d95355b 100644 --- a/utils/spdx/src/main/kotlin/SpdxExpression.kt +++ b/utils/spdx/src/main/kotlin/SpdxExpression.kt @@ -257,9 +257,9 @@ class SpdxCompoundExpression( SpdxOperator.AND -> when { leftDnf is SpdxCompoundExpression && leftDnf.operator == SpdxOperator.OR && - rightDnf is SpdxCompoundExpression && rightDnf.operator == SpdxOperator.OR -> + rightDnf is SpdxCompoundExpression && rightDnf.operator == SpdxOperator.OR -> ((leftDnf.left and rightDnf.left) or (leftDnf.left and rightDnf.right)) or - ((leftDnf.right and rightDnf.left) or (leftDnf.right and rightDnf.right)) + ((leftDnf.right and rightDnf.left) or (leftDnf.right and rightDnf.right)) leftDnf is SpdxCompoundExpression && leftDnf.operator == SpdxOperator.OR -> (leftDnf.left and rightDnf) or (leftDnf.right and rightDnf) @@ -484,7 +484,7 @@ class SpdxLicenseWithExceptionExpression( } else { throw SpdxException( "'$this' cannot be normalized, because the license '$license' contains the exception " + - "'${normalizedLicense.exception}' which is different from '$exception'." + "'${normalizedLicense.exception}' which is different from '$exception'." ) } } diff --git a/utils/spdx/src/main/kotlin/Utils.kt b/utils/spdx/src/main/kotlin/Utils.kt index 588b94887318..af7cc287a888 100644 --- a/utils/spdx/src/main/kotlin/Utils.kt +++ b/utils/spdx/src/main/kotlin/Utils.kt @@ -101,7 +101,7 @@ fun calculatePackageVerificationCode(directory: File): String { // Sort the list of files to show the files in a directory before the files in its subdirectories. This can be // omitted once breadth-first search is available in Kotlin: https://youtrack.jetbrains.com/issue/KT-18629 val sortedExcludes = spdxFiles.map { "./${it.relativeTo(directory).invariantSeparatorsPath}" } - .sortedWith(PATH_STRING_COMPARATOR) + .sortedWith(PATH_STRING_COMPARATOR) return calculatePackageVerificationCode(files, sortedExcludes) } diff --git a/utils/spdx/src/main/kotlin/model/SpdxChecksum.kt b/utils/spdx/src/main/kotlin/model/SpdxChecksum.kt index 598ca6dfd16d..ca66dff99089 100644 --- a/utils/spdx/src/main/kotlin/model/SpdxChecksum.kt +++ b/utils/spdx/src/main/kotlin/model/SpdxChecksum.kt @@ -58,7 +58,7 @@ data class SpdxChecksum( require(algorithm.checksumHexDigits == -1 || checksumValue.length == algorithm.checksumHexDigits) { "Expected a checksum value with ${algorithm.checksumHexDigits} hexadecimal symbols, but found " + - "${checksumValue.length}." + "${checksumValue.length}." } } } diff --git a/utils/spdx/src/main/kotlin/model/SpdxDocument.kt b/utils/spdx/src/main/kotlin/model/SpdxDocument.kt index 9c16bfcdc50b..650578e4f0d9 100644 --- a/utils/spdx/src/main/kotlin/model/SpdxDocument.kt +++ b/utils/spdx/src/main/kotlin/model/SpdxDocument.kt @@ -147,7 +147,7 @@ data class SpdxDocument( val duplicateExternalDocumentRefs = externalDocumentRefs.getDuplicates { it.externalDocumentId } require(duplicateExternalDocumentRefs.isEmpty()) { "The document must not contain duplicate external document references but has " + - "${duplicateExternalDocumentRefs.keys}." + "${duplicateExternalDocumentRefs.keys}." } require(documentNamespace.isNotBlank()) { "The document namespace must not be blank." } @@ -170,7 +170,7 @@ data class SpdxDocument( val hasDescribesRelationship = relationships.any { it.relationshipType == SpdxRelationship.Type.DESCRIBES } require(hasDescribesRelationship || documentDescribes.isNotEmpty()) { "The document must either have at least one relationship of type 'DESCRIBES' or contain the " + - "'documentDescribes' field." + "'documentDescribes' field." } } } diff --git a/utils/spdx/src/main/kotlin/model/SpdxExternalReference.kt b/utils/spdx/src/main/kotlin/model/SpdxExternalReference.kt index ed5449a86571..40bfab8ff225 100644 --- a/utils/spdx/src/main/kotlin/model/SpdxExternalReference.kt +++ b/utils/spdx/src/main/kotlin/model/SpdxExternalReference.kt @@ -87,7 +87,7 @@ data class SpdxExternalReference( require(referenceType.category == Category.OTHER || referenceType.category == referenceCategory) { "The category for '${referenceType.name}' must be '${referenceType.category}', but was " + - "'$referenceCategory'." + "'$referenceCategory'." } } diff --git a/utils/spdx/src/main/kotlin/model/SpdxPackageVerificationCode.kt b/utils/spdx/src/main/kotlin/model/SpdxPackageVerificationCode.kt index 61e0f677dc11..f9f9b1a15307 100644 --- a/utils/spdx/src/main/kotlin/model/SpdxPackageVerificationCode.kt +++ b/utils/spdx/src/main/kotlin/model/SpdxPackageVerificationCode.kt @@ -39,12 +39,12 @@ data class SpdxPackageVerificationCode( init { require(packageVerificationCodeValue.matches(SpdxChecksum.HEX_SYMBOLS_REGEX)) { "The package verification code must only contain lower case hexadecimal digits but was " + - "'$packageVerificationCodeValue'." + "'$packageVerificationCodeValue'." } require(SpdxChecksum.Algorithm.SHA1.checksumHexDigits == packageVerificationCodeValue.length) { "Expected a checksum value with ${SpdxChecksum.Algorithm.SHA1.checksumHexDigits} hexadecimal digits, but " + - "found ${packageVerificationCodeValue.length}." + "found ${packageVerificationCodeValue.length}." } } } diff --git a/utils/spdx/src/main/kotlin/model/SpdxSnippet.kt b/utils/spdx/src/main/kotlin/model/SpdxSnippet.kt index b986eccee85c..e599d3a13844 100644 --- a/utils/spdx/src/main/kotlin/model/SpdxSnippet.kt +++ b/utils/spdx/src/main/kotlin/model/SpdxSnippet.kt @@ -106,7 +106,7 @@ data class SpdxSnippet( licenseInfoInSnippets.filterNot { it.isSpdxExpressionOrNotPresent() }.let { invalidEntries -> require(invalidEntries.isEmpty()) { "The entries in licenseInfoInSnippets must each be either an SpdxExpression, 'NONE' or " + - "'NOASSERTION', but found ${invalidEntries.joinToString()}." + "'NOASSERTION', but found ${invalidEntries.joinToString()}." } } diff --git a/utils/spdx/src/test/kotlin/ExtensionsTest.kt b/utils/spdx/src/test/kotlin/ExtensionsTest.kt index cd8edb03415c..ba015c55494c 100644 --- a/utils/spdx/src/test/kotlin/ExtensionsTest.kt +++ b/utils/spdx/src/test/kotlin/ExtensionsTest.kt @@ -33,7 +33,7 @@ class ExtensionsTest : WordSpec({ "convert ORT Identifier coordinate strings" { "Maven:org.eclipse.jetty:jetty-client:9.4.42.v20210604".toSpdxId() shouldBe - "Maven-org.eclipse.jetty-jetty-client-9.4.42.v20210604" + "Maven-org.eclipse.jetty-jetty-client-9.4.42.v20210604" "Pub:crypto:crypto:2.1.1+1".toSpdxId(allowPlusSuffix = true) shouldBe "Pub-crypto-crypto-2.1.1.1" "NPM::lodash._reinterpolate:3.0.0".toSpdxId() shouldBe "NPM-lodash.reinterpolate-3.0.0" } diff --git a/utils/spdx/src/test/kotlin/SpdxExpressionParserTest.kt b/utils/spdx/src/test/kotlin/SpdxExpressionParserTest.kt index 99c96375f886..817efe398ba9 100644 --- a/utils/spdx/src/test/kotlin/SpdxExpressionParserTest.kt +++ b/utils/spdx/src/test/kotlin/SpdxExpressionParserTest.kt @@ -201,7 +201,7 @@ class SpdxExpressionParserTest : WordSpec({ } exception.message shouldBe - "mismatched input '' expecting {'(', DOCUMENTREFERENCE, LICENSEREFERENCE, IDSTRING}" + "mismatched input '' expecting {'(', DOCUMENTREFERENCE, LICENSEREFERENCE, IDSTRING}" } } }) diff --git a/utils/spdx/src/test/kotlin/SpdxExpressionTest.kt b/utils/spdx/src/test/kotlin/SpdxExpressionTest.kt index 1c472d039a23..6a3bbee676c9 100644 --- a/utils/spdx/src/test/kotlin/SpdxExpressionTest.kt +++ b/utils/spdx/src/test/kotlin/SpdxExpressionTest.kt @@ -182,20 +182,20 @@ class SpdxExpressionTest : WordSpec({ "be valid in lenient mode" { assertSoftly { licenseRefWithLicenseRefException.toSpdx(Strictness.ALLOW_ANY) shouldBe - SpdxLicenseWithExceptionExpression( - SpdxLicenseReferenceExpression("LicenseRef-ort-license"), - "LicenseRef-ort-exception" - ) + SpdxLicenseWithExceptionExpression( + SpdxLicenseReferenceExpression("LicenseRef-ort-license"), + "LicenseRef-ort-exception" + ) licenseRefWithLicenseRefException2.toSpdx(Strictness.ALLOW_ANY) shouldBe - SpdxLicenseWithExceptionExpression( - SpdxLicenseReferenceExpression("LicenseRef-ort-license"), - "LicenseRef-ort-exception-2.0" - ) + SpdxLicenseWithExceptionExpression( + SpdxLicenseReferenceExpression("LicenseRef-ort-license"), + "LicenseRef-ort-exception-2.0" + ) licenseRefWithLicenseRef.toSpdx(Strictness.ALLOW_ANY) shouldBe - SpdxLicenseWithExceptionExpression( - SpdxLicenseReferenceExpression("LicenseRef-ort-license"), - "LicenseRef-ort-license" - ) + SpdxLicenseWithExceptionExpression( + SpdxLicenseReferenceExpression("LicenseRef-ort-license"), + "LicenseRef-ort-license" + ) } } @@ -234,15 +234,15 @@ class SpdxExpressionTest : WordSpec({ "be valid when allowing LicenseRef exceptions" { assertSoftly { licenseRefWithLicenseRefException.toSpdx(Strictness.ALLOW_LICENSEREF_EXCEPTIONS) shouldBe - SpdxLicenseWithExceptionExpression( - SpdxLicenseReferenceExpression("LicenseRef-ort-license"), - "LicenseRef-ort-exception" - ) + SpdxLicenseWithExceptionExpression( + SpdxLicenseReferenceExpression("LicenseRef-ort-license"), + "LicenseRef-ort-exception" + ) licenseRefWithLicenseRefException2.toSpdx(Strictness.ALLOW_LICENSEREF_EXCEPTIONS) shouldBe - SpdxLicenseWithExceptionExpression( - SpdxLicenseReferenceExpression("LicenseRef-ort-license"), - "LicenseRef-ort-exception-2.0" - ) + SpdxLicenseWithExceptionExpression( + SpdxLicenseReferenceExpression("LicenseRef-ort-license"), + "LicenseRef-ort-exception-2.0" + ) shouldThrow { licenseRefWithLicenseRef.toSpdx(Strictness.ALLOW_LICENSEREF_EXCEPTIONS) @@ -313,19 +313,19 @@ class SpdxExpressionTest : WordSpec({ "normalize deprecated license exceptions to non-deprecated ones" { assertSoftly { "GPL-2.0-with-autoconf-exception".toSpdx().normalize() shouldBe - (GPL_2_0_ONLY with AUTOCONF_EXCEPTION_2_0) + (GPL_2_0_ONLY with AUTOCONF_EXCEPTION_2_0) "GPL-2.0-with-bison-exception".toSpdx().normalize() shouldBe - (GPL_2_0_ONLY with BISON_EXCEPTION_2_2) + (GPL_2_0_ONLY with BISON_EXCEPTION_2_2) "GPL-2.0-with-classpath-exception".toSpdx().normalize() shouldBe - (GPL_2_0_ONLY with CLASSPATH_EXCEPTION_2_0) + (GPL_2_0_ONLY with CLASSPATH_EXCEPTION_2_0) "GPL-2.0-with-font-exception".toSpdx().normalize() shouldBe - (GPL_2_0_ONLY with FONT_EXCEPTION_2_0) + (GPL_2_0_ONLY with FONT_EXCEPTION_2_0) "GPL-2.0-with-GCC-exception".toSpdx().normalize() shouldBe - (GPL_2_0_ONLY with GCC_EXCEPTION_2_0) + (GPL_2_0_ONLY with GCC_EXCEPTION_2_0) "GPL-3.0-with-autoconf-exception".toSpdx().normalize() shouldBe - (GPL_3_0_ONLY with AUTOCONF_EXCEPTION_3_0) + (GPL_3_0_ONLY with AUTOCONF_EXCEPTION_3_0) "GPL-3.0-with-GCC-exception".toSpdx().normalize() shouldBe - (GPL_3_0_ONLY with GCC_EXCEPTION_3_1) + (GPL_3_0_ONLY with GCC_EXCEPTION_3_1) } } } @@ -349,9 +349,9 @@ class SpdxExpressionTest : WordSpec({ "work with LicenseRef-* identifiers" { "LicenseRef-gpl-2.0-custom WITH Classpath-exception-2.0 AND LicenseRef-scancode-commercial-license" .decompose() should containExactlyInAnyOrder( - "LicenseRef-gpl-2.0-custom WITH Classpath-exception-2.0", - "LicenseRef-scancode-commercial-license" - ) + "LicenseRef-gpl-2.0-custom WITH Classpath-exception-2.0", + "LicenseRef-scancode-commercial-license" + ) } "return distinct strings" { @@ -362,9 +362,9 @@ class SpdxExpressionTest : WordSpec({ "not merge license-exception pairs with single matching licenses" { "GPL-2.0-or-later WITH Classpath-exception-2.0 AND GPL-2.0-or-later" .decompose() should containExactlyInAnyOrder( - "GPL-2.0-or-later WITH Classpath-exception-2.0", - "GPL-2.0-or-later" - ) + "GPL-2.0-or-later WITH Classpath-exception-2.0", + "GPL-2.0-or-later" + ) } } @@ -383,12 +383,12 @@ class SpdxExpressionTest : WordSpec({ "correctly convert ORs on both sides of an AND expression" { "(a OR b) AND (c OR d)".toSpdx().disjunctiveNormalForm() should - beString("(a AND c) OR (a AND d) OR (b AND c) OR (b AND d)") + beString("(a AND c) OR (a AND d) OR (b AND c) OR (b AND d)") } "correctly convert a complex expression" { "(a OR b) AND c AND (d OR e)".toSpdx().disjunctiveNormalForm() should - beString("(a AND c AND d) OR (a AND c AND e) OR (b AND c AND d) OR (b AND c AND e)") + beString("(a AND c AND d) OR (a AND c AND e) OR (b AND c AND d) OR (b AND c AND e)") } } @@ -406,7 +406,7 @@ class SpdxExpressionTest : WordSpec({ "correctly sort a complex expression" { "(h OR g) AND (f OR e) OR (c OR d) AND (a OR b)".toSpdx().sorted() should - beString("((a OR b) AND (c OR d)) OR ((e OR f) AND (g OR h))") + beString("((a OR b) AND (c OR d)) OR ((e OR f) AND (g OR h))") } } diff --git a/utils/spdx/src/test/kotlin/SpdxLicenseTest.kt b/utils/spdx/src/test/kotlin/SpdxLicenseTest.kt index 3e5092e3157c..c19d6631f63e 100644 --- a/utils/spdx/src/test/kotlin/SpdxLicenseTest.kt +++ b/utils/spdx/src/test/kotlin/SpdxLicenseTest.kt @@ -52,11 +52,11 @@ class SpdxLicenseTest : WordSpec({ gpl20OrLater shouldNotBeNull { val gpl20OrLaterText = text.replace("\n", " ").trimEnd() gpl20OrLaterText shouldStartWith "This program is free software; you can redistribute it and/or " + - "modify it under the terms of the GNU General Public License" + "modify it under the terms of the GNU General Public License" gpl20OrLaterText shouldContain "; either version 2 of the License, or (at your option) any later " + - "version." + "version." gpl20OrLaterText shouldEndWith "If this is what you want to do, use the GNU Lesser General Public " + - "License instead of this License." + "License instead of this License." } } diff --git a/utils/spdx/src/test/kotlin/UtilsTest.kt b/utils/spdx/src/test/kotlin/UtilsTest.kt index 4c4cbcc83f72..522e8176c579 100644 --- a/utils/spdx/src/test/kotlin/UtilsTest.kt +++ b/utils/spdx/src/test/kotlin/UtilsTest.kt @@ -87,7 +87,7 @@ class UtilsTest : WordSpec() { calculatePackageVerificationCode(sha1sums) shouldBe "1a74d8321c452522ec516a46893e6a42f36b5953" calculatePackageVerificationCode(sha1sums, excludes) shouldBe - "1a74d8321c452522ec516a46893e6a42f36b5953 (excludes: ./package.spdx)" + "1a74d8321c452522ec516a46893e6a42f36b5953 (excludes: ./package.spdx)" } "work for given files and excludes" { @@ -100,7 +100,7 @@ class UtilsTest : WordSpec() { calculatePackageVerificationCode(files) shouldBe "378d5a37b5b10b90535e32a190014d2a8d25354a" calculatePackageVerificationCode(files, excludes) shouldBe - "378d5a37b5b10b90535e32a190014d2a8d25354a (excludes: ./package.spdx)" + "378d5a37b5b10b90535e32a190014d2a8d25354a (excludes: ./package.spdx)" } "work for a given file" { @@ -118,7 +118,7 @@ class UtilsTest : WordSpec() { setupTempFile("dir/package.spdx", "content") calculatePackageVerificationCode(tempDir) shouldBe - "15d3fa138d9302ec9a1584180b5eba0d342b60fa (excludes: ./package.spdx, ./dir/package.spdx)" + "15d3fa138d9302ec9a1584180b5eba0d342b60fa (excludes: ./package.spdx, ./dir/package.spdx)" } "exclude VCS directories" { @@ -129,7 +129,7 @@ class UtilsTest : WordSpec() { } calculatePackageVerificationCode(tempDir) shouldBe - "81e250a78cc6386afc25fa57ad6eaee31394019b" + "81e250a78cc6386afc25fa57ad6eaee31394019b" } } diff --git a/utils/spdx/src/test/kotlin/model/SpdxDocumentTest.kt b/utils/spdx/src/test/kotlin/model/SpdxDocumentTest.kt index af271917d193..64f42888c18b 100644 --- a/utils/spdx/src/test/kotlin/model/SpdxDocumentTest.kt +++ b/utils/spdx/src/test/kotlin/model/SpdxDocumentTest.kt @@ -95,7 +95,7 @@ class SpdxDocumentTest : WordSpec({ } exception.message shouldContain "The document must either have at least one relationship of type " + - "'DESCRIBES' or contain the 'documentDescribes' field." + "'DESCRIBES' or contain the 'documentDescribes' field." } } })