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

mauin

02/06/2018, 6:42 AM
If I understand correctly you’re only adding detekt to the top-level
build.gradle
file and then executing tasks for different gradle modules gives different results? And you also only define the config in the root project? If that’s the case it sounds weird. I agree, it makes sense only picking up the defined sourceSets and recursing in them to find all
.kt
files. However that will mean that the Gradle Plugin would have to automatically add detekt tasks to all submodules if the plugin is defined in the top-level. Otherwise we would never have any sourcesets to access.
t

Tobi

02/06/2018, 7:14 AM
I think it’s the other way around. The
detekt
closure is in the
app
using a
config
that sets the
maxLineLength
to 150.
app:detektCheck
respects that config and passes
detektCheck
doesn’t and fails considering the same files
m

mauin

02/06/2018, 7:19 AM
Ah, I see. Yeah, that doesn’t really make sense. Even then the
detektCheck
task should respect the config defined in the
app
module. Kind of sounds like two different things to me. One is respecting the correct config, the other is @sebs suggestion to respect the sourcesets of the given gradle module instead of just recursing from wherever the
detektCheck
task was called.
s

seb

02/06/2018, 9:38 AM
I have also tried the other way around, applied to both the root and subprojects (via
subprojects
closure in the root build script), but then it would pass
detektCheck
and not
app:detektCheck
m

mauin

02/06/2018, 9:40 AM
That sounds like something we should take a look at. Feel free to open a new issue or add to an existing one. Both cases actually. 🙂
👍 1
2 Views