iamthevoid
12/05/2021, 8:19 AMNoUnusedImports
issue and it autocorrects. Now i get another issue UnusedImports
and these unused imports don't disappear (autocorrecting not working)
Or before i got issue when blank lines were in end of file or between class members. Now i got BUILD SUCCESSFUL
in same cases.
I though it was wrong paths - but checked - config and baseline path points exactly where i want too. Sources folders also set correctly (when i comment they - i get BUILD SUCCESSFUL
in cases when shouldn't)
What do i miss? Config in threadimport io.gitlab.arturbosch.detekt.Detekt
plugins { id("io.gitlab.arturbosch.detekt") }
dependencies { detektPlugins(detektPluginVersion()) }
detekt {
// println(rootDir.absolutePath)
toolVersion = detektVersion()
config = rootProject.rootDirFiles("config/detekt/detekt.yml")
baseline = rootProject.rootDirFile("config/detekt/baseline.xml")
input.setFrom(
"src/androidTest/java",
"src/androidTest/kotlin",
"src/debug/java",
"src/debug/kotlin",
"src/release/java",
"src/release/kotlin",
"src/main/kotlin",
"src/main/java",
"src/commonMain/kotlin",
"src/androidMain/kotlin",
"src/iosMain/kotlin"
)
parallel = true
autoCorrect = true
reports {
xml {
enabled = true
destination = rootDirFile("build/report/detekt.xml")
}
txt {
enabled = true
destination = rootDirFile("build/report/detekt.txt")
}
}
}
tasks.withType<Detekt>().configureEach {
jvmTarget = Versions.jvmTarget
}
repositories {
mavenCentral()
}
fun Project.rootDirFile(path: String): File {
println(File("$rootDir/$path").run { "$absolutePath ${if (exists()) "exists" else "not exists"}" })
return file("$rootDir/$path")
}
fun Project.rootDirFiles(path: String): ConfigurableFileCollection {
println(File("$rootDir/$path").run { "$absolutePath ${if (exists()) "exists" else "not exists"}" })
return files("$rootDir/$path")
}
fun Project.detektPluginVersion(): String {
return "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${detektVersion()}"
}
fun Project.detektVersion(): String {
return version("versions.detekt")
}
// Try to get overrode version from project local.properties, or else fallback to project gradle
// properties
private fun Project.version(key: String): String {
return properties("${rootDir.absolutePath}/local.properties")?.getProperty(key)
?: project.properties[key]?.let(Any::toString).orEmpty()
}
allprojects {
.....
apply(plugin = "detekt-convention")
.....
}
Brais Gabin
12/05/2021, 11:49 AMdependencies.detektPlugins
. It should `point to dete`kt-format and it points to the gradle plugin.iamthevoid
12/05/2021, 1:11 PM