Skip to content

Commit c349dc4

Browse files
committed
fix(detekt-rules): Correctly determine the root project
This did not cause violations for nested projects because the rule was skipped in that case due to `pathPattern` not being matched. Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.io>
1 parent f893ace commit c349dc4

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

detekt-rules/src/main/kotlin/OrtPackageNaming.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class OrtPackageNaming(config: Config) : Rule(
5151

5252
// TODO: Find a better way to determine the project path. Unfortunately, `KtFile.project.basePath` is null.
5353
projectPath = generateSequence(root.absolutePath()) { it.parent }.find {
54-
it.resolve("build.gradle.kts").isRegularFile()
54+
it.resolve("settings.gradle.kts").isRegularFile()
5555
}
5656
}
5757

detekt-rules/src/test/kotlin/OrtPackageNamingTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class OrtPackageNamingTest : WordSpec({
151151
})
152152

153153
private fun TestConfiguration.createFile(dir: String, content: String): KtFile {
154-
val projectDir = tempdir().apply { resolve("build.gradle.kts").createNewFile() }
154+
val projectDir = tempdir().apply { resolve("settings.gradle.kts").createNewFile() }
155155
val parent = projectDir.resolve(dir).safeMkdirs()
156156
val file = parent.resolve("Test.kt").apply { writeText(content) }
157157
return compileForTest(file.toPath())

0 commit comments

Comments
 (0)