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

Eric

03/14/2022, 3:43 PM
is there a way to globally exclude a directory? we have some generated code checked in (yes… we know). And want to exclude that directory from contributing to score and from being formatted automatically.
e

ephemient

03/14/2022, 3:49 PM
I make my code generators emit
@file:Suppress("ALL")
👍 2
e

Eric

03/14/2022, 3:50 PM
yeah, was also looking at that. would need to configure the apollo GQL generator to do that
t

Tim Oltjenbruns

03/14/2022, 4:23 PM
Maybe you could put the generated code in it’s own Source Set? And exclude it by the path?
e

Eric

03/14/2022, 5:08 PM
I was able to do it using that link above like this:
Copy code
tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach {
    exclude("com/example/graphql/client/**")
}
💯 2
c

chao

03/14/2022, 6:07 PM
It is documented here https://detekt.dev/gradle.html#leveraging-gradles-sourcetask---excluding-and-including-source-files and if baseline is used, we also need to configure
DetektCreateBaselineTask
344 Views