https://kotlinlang.org logo
#detekt
Title
# detekt
l

Luke

03/04/2020, 8:58 PM
I would like some assistance integrating Detekt in my Android project. I successfully generated my config file, but that’s all that is working. Both tasks
detektBaseline
and
detekt
finish successfully in 1 second and nothing else happens, even though I know for a fact that the code contains errors. The only way I had it working was by creating my own Gradle tasks, but I don’t want to do this if I don’t have to. I have this in my project-level Gradle:
Copy code
plugins {
    id "io.gitlab.arturbosch.detekt" version "1.6.0"
}

detekt {
    toolVersion = "1.6.0"

    config = files("$projectDir/config/detekt/detekt.yml")
    baseline = file("$projectDir/config/detekt/baseline.xml")
//    source = files("src/main/kotlin") // This does not work for some reasons (Could not set unknown property 'source' for object of type io.gitlab.arturbosch.detekt.extensions.DetektExtension.)

    buildUponDefaultConfig = true
    parallel = true
    ignoreFailures = true

    reports {
        txt.enabled = false
        xml.enabled = false
        html {
            enabled = true
            destination = file("$projectDir/reports/detekt/report.html")
        }
    }
}
s

Shiveen Pandita

03/04/2020, 11:48 PM
could you please confirm if you ran
detektCheck
?
l

Luke

03/05/2020, 2:18 PM
detektCheck
outputs
Task 'detektCheck' not found in root project '...'.
. My understanding was that it was replaced by simply
detekt
.
input
instead of
source
seams to work
c

Cody Engel

03/10/2020, 5:49 PM
Hey @Luke were you able to find a solution to this? I'm trying to do a fresh setup but having no luck
Actually I think I was able to make it run by using a previous setup I had in the past
If you remove plugins and instead use `
Copy code
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${versions.detekt}"
Followed by
apply plugin: "io.gitlab.arturbosch.detekt"
It ends up running 🤷🏻‍♂️
l

Luke

03/10/2020, 6:01 PM
I did make it work in the end. Unfortunately, I’m not sure which step made it work. I remember including ktlint, then it was working. And it was still working when I removed ktlint.
🙇🏻‍♂️ 1
4 Views