From 3207d1ed7f5ce11ad5ee37499b488d885edfc272 Mon Sep 17 00:00:00 2001 From: Nicolas Nobelis Date: Mon, 2 Oct 2023 09:07:19 +0200 Subject: [PATCH] style(detekt): Enable the "MissingPackageDeclaration" rule Enable the "MissingPackageDeclaration" rule [1] to ensure that all Kotlin source files have a package declaration. [1]: https://detekt.dev/docs/rules/potential-bugs#missingpackagedeclaration Signed-off-by: Nicolas Nobelis --- .detekt.yml | 5 +++++ advisor/src/funTest/kotlin/OsvFunTest.kt | 2 ++ clients/osv/src/funTest/kotlin/OsvServiceFunTest.kt | 7 ++----- clients/scanoss/src/test/kotlin/ScanOssDetailsTest.kt | 3 ++- clients/scanoss/src/test/kotlin/ScanOssServiceTest.kt | 3 ++- .../kotlin/OrtConfigPackageConfigurationProviderFunTest.kt | 3 ++- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.detekt.yml b/.detekt.yml index 7f2f52c575102..f17887196165f 100644 --- a/.detekt.yml +++ b/.detekt.yml @@ -94,6 +94,11 @@ style: - kotlinx.html.* - kotlinx.html.dom.* +potential-bugs: + MissingPackageDeclaration: + active: true + excludes: ["**/GradleModel.kt", "**/build.gradle.kts"] + ORT: OrtImportOrder: active: true diff --git a/advisor/src/funTest/kotlin/OsvFunTest.kt b/advisor/src/funTest/kotlin/OsvFunTest.kt index e7a6f1fadd889..9ae4e00fb63fe 100644 --- a/advisor/src/funTest/kotlin/OsvFunTest.kt +++ b/advisor/src/funTest/kotlin/OsvFunTest.kt @@ -17,6 +17,8 @@ * License-Filename: LICENSE */ +package org.ossreviewtoolkit.advisor + import io.kotest.core.spec.style.StringSpec import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder import io.kotest.matchers.shouldBe diff --git a/clients/osv/src/funTest/kotlin/OsvServiceFunTest.kt b/clients/osv/src/funTest/kotlin/OsvServiceFunTest.kt index a7913110af1a8..6c7af0882801f 100644 --- a/clients/osv/src/funTest/kotlin/OsvServiceFunTest.kt +++ b/clients/osv/src/funTest/kotlin/OsvServiceFunTest.kt @@ -17,6 +17,8 @@ * License-Filename: LICENSE */ +package org.ossreviewtoolkit.clients.osv + import io.kotest.core.spec.style.StringSpec import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder import io.kotest.matchers.result.shouldBeSuccess @@ -26,11 +28,6 @@ import java.time.Instant import kotlinx.serialization.json.JsonObject -import org.ossreviewtoolkit.clients.osv.OsvApiClient -import org.ossreviewtoolkit.clients.osv.OsvService -import org.ossreviewtoolkit.clients.osv.Package -import org.ossreviewtoolkit.clients.osv.VulnerabilitiesForPackageRequest -import org.ossreviewtoolkit.clients.osv.Vulnerability import org.ossreviewtoolkit.utils.test.getAssetAsString private val VULNERABILITY_FOR_PACKAGE_BY_COMMIT_REQUEST = VulnerabilitiesForPackageRequest( diff --git a/clients/scanoss/src/test/kotlin/ScanOssDetailsTest.kt b/clients/scanoss/src/test/kotlin/ScanOssDetailsTest.kt index 2ee825ac83e86..d4ea0900617df 100644 --- a/clients/scanoss/src/test/kotlin/ScanOssDetailsTest.kt +++ b/clients/scanoss/src/test/kotlin/ScanOssDetailsTest.kt @@ -17,6 +17,8 @@ * License-Filename: LICENSE */ +package org.ossreviewtoolkit.clients.scanoss + import com.github.tomakehurst.wiremock.WireMockServer import com.github.tomakehurst.wiremock.core.WireMockConfiguration @@ -34,7 +36,6 @@ import okhttp3.MediaType.Companion.toMediaType import okhttp3.MultipartBody import okhttp3.RequestBody.Companion.asRequestBody -import org.ossreviewtoolkit.clients.scanoss.ScanOssService import org.ossreviewtoolkit.clients.scanoss.model.Source import org.ossreviewtoolkit.utils.test.shouldNotBeNull diff --git a/clients/scanoss/src/test/kotlin/ScanOssServiceTest.kt b/clients/scanoss/src/test/kotlin/ScanOssServiceTest.kt index db3a27883ca38..c7342337b2512 100644 --- a/clients/scanoss/src/test/kotlin/ScanOssServiceTest.kt +++ b/clients/scanoss/src/test/kotlin/ScanOssServiceTest.kt @@ -17,6 +17,8 @@ * License-Filename: LICENSE */ +package org.ossreviewtoolkit.clients.scanoss + import com.github.tomakehurst.wiremock.WireMockServer import com.github.tomakehurst.wiremock.core.WireMockConfiguration @@ -33,7 +35,6 @@ import okhttp3.MediaType.Companion.toMediaType import okhttp3.MultipartBody import okhttp3.RequestBody.Companion.asRequestBody -import org.ossreviewtoolkit.clients.scanoss.ScanOssService import org.ossreviewtoolkit.clients.scanoss.model.IdentificationType import org.ossreviewtoolkit.utils.test.shouldNotBeNull 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 f5448757bb60a..ecba0841bc648 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 @@ -17,6 +17,8 @@ * License-Filename: LICENSE */ +package org.ossreviewtoolkit.plugins.packageconfigurationproviders.ortconfig + import io.kotest.core.spec.style.StringSpec import io.kotest.matchers.collections.beEmpty import io.kotest.matchers.collections.haveSize @@ -26,7 +28,6 @@ import org.ossreviewtoolkit.model.ArtifactProvenance import org.ossreviewtoolkit.model.Hash import org.ossreviewtoolkit.model.Identifier import org.ossreviewtoolkit.model.RemoteArtifact -import org.ossreviewtoolkit.plugins.packageconfigurationproviders.ortconfig.OrtConfigPackageConfigurationProvider class OrtConfigPackageConfigurationProviderFunTest : StringSpec({ "provider can load package-configurations from the ort-config repository" {