hello everyone. I am following some instrctions to...
# detekt
f
hello everyone. I am following some instrctions to execute detekt in entire project, so now I have the task :
Copy code
tasks.register("detektAll") {
    allprojects {
        this@register.dependsOn(tasks.withType<io.gitlab.arturbosch.detekt.Detekt>())
    }
}
I would like to run the detektAll in each build, but I unable configure that. Do you know a better approach to run detekt in entire project ???
s
Gradle uses name-matching execution, so if you run a task in the root project, it will run tasks with that name in every subproject.
f
Ok, but I do not understand how to use name-matching execution to run detekt in entire project in each build.
j
Technically you are not running the task on the rootProject
Supposing you have three projects with detekt task, rootProject (
:
),
a
, and
b
If you run
./gradlew detekt
, it will execute
Copy code
:detekt
:a:detekt
:b:detekt
if you run
./gradlew :detekt
it will execute
Copy code
:detekt
which is the rootProject one
similar for
./gradlew :a:detekt
f
ok, i ran shareddetekt but the task does not execute the checks. Is the correct run detektMetadata* tasks and shareddetektAndroidRelease / shareddetektAndroidDebug ???
m
You can use the sample i shared here: https://github.com/detekt/detekt/issues/5611#issuecomment-1365505710 It run all the tasks from all the modules plus it support also KMP