I have trouble with non-working excludes, I've fou...
# detekt
d
I have trouble with non-working excludes, I've found several related answers in this chat, but they all are fixed by including
withType
in
subprojects
while I already have this:
Copy code
subprojects {
  apply plugin: "io.gitlab.arturbosch.detekt"
  detekt { ... }

  tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach {
    exclude("**/entity/generated/**")
  }
}
And yet the file with path like this:
Copy code
module/src/main/kotlin/data/network/entity/generated/AmountModel.kt:34:3
ends up being checked by detekt. Any hints on what I did wrong? Version is
1.18.1
g
Your setup looks correct to me. I’m not sure about the
**/entity/generated/**
string though
d
I tried changing it to
**/generated/**
but the errors are still there ...
For context: early on we had a root-level detekt task which had input from rootProject.files. But now I want to enable type resolution, so I'm moving to a per-project configuration. Prior to this move, those patterns were correctly excluded. But now, after moving everything into
subprojects
, they somehow don't work, not sure why... Though we also have
**/build/**
pattern and it seems to work... strange.
b
If I remember correctly the exclude in gradle is ignored if you use type solving. If you use the regular
detekt
it should work.
So this is probably a bug. You can fill a bug so we can decide what to do with it.
d
I see, yes, this manifested only when I started using type resolution
Before I fell asleep yesterday, I had a thought that maybe this is somehow caused by the fact that
Copy code
tasks.withType<com....Detect> { exclude(...) }
while type resolution has tasks like
detektMain
,
detektDebug
, etc