Is it enough to run `detektMain` gradle task, or i...
# detekt
p
Is it enough to run
detektMain
gradle task, or is it also required to run
detekt
?
m
As always - that depends.
detektMain
will only check the production code, not the tests. If all you want to check, then that is sufficient. The rules that are being checked by
detekt
are a subset of those run by
detektMain
, so it is not necessary to run both when configured for the same source files.
b
In my case I always execute detektMain and detektTest. Never detekt.
plus1 3
j
I added following task for convenience:
Copy code
tasks.register("detektDebugAll") {
    dependsOn("detektDebug", "detektDebugUnitTest", "detektDebugAndroidTest")
}
Also use this one in a pre-push hook then.
b
Yes, I have exactly the same.
p
I see. Thanks for info 🍺
c
Hello everyone, I just came across this thread as I had a similar question. My understanding from the Getting Started page was that
detekt
was a super-set of
detektMain
. But in practice this is not what I am seeing and instead what I see is what @marschwar mentions(
detektMain
is a superset of
detek
). But this seems like a bug to me, Even the page described them as:
detektMain
- Similar to
detekt
, but runs only on the
main
source set.
I will file a bug and see what the detekt team says.
Never mind, I misunderstood type resolution, so the behaviour of
detekt
and
detektMain
is described here.