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

Henning B

03/25/2021, 4:27 PM
Hi there! I want to integrate Detekt in a large Android code base. We have multiple modules with different build variants. E.g. we got several modules with the variant free/pro. When I run detektFreeDebug for only one module a report is created. I can create reports for the other modules by executing moduleName:detektFreeDebug though. Is this normal? Is it possible to execute all matching modules with one task?
g

gammax

03/25/2021, 8:12 PM
If you invoke
./gradlew detektFreeDebug
it should run all the tasks with that name in your build.
h

Henning B

03/26/2021, 7:30 AM
Thanks for the answer! I will investigate 🕵️‍♂️
I found the reason why only one module was executed. I want to try to put the reports for all modules into the same folder. therefore I added
Copy code
html {
    enabled = true
    val projectName = project.name
    destination = file("$rootDir/build/reports/detekt/$projectName.html")
}
to the project gradle file. when I remove the special destination, all modules are analyzed. is there a way to run all modules but also put all files into the same directory?
g

gammax

03/26/2021, 4:10 PM
I want to try to put the reports for all modules into the same folder
So if you want to merge all the reports, you need to follow this:
h

Henning B

03/26/2021, 4:11 PM
that would also be an option. initially my code would put them into the same directory and naming them according to the module name. I will look into merging, thanks!
🙏 2
somehow today it behaves differently 😂 Putting my reports in the same directory does not prevent execution of different modules. A failing module does. So when I have multiple modules with errors I don't get reports for all problems. Only for the problems in the first failing module. I can set
ignoreFailures
to true to get all reports, but than my CI wouldn't fail. Is there an option to fail the overall task but also create reports for all modules?
g

gammax

03/29/2021, 2:21 PM
Have you tried running with
--continue
?
h

Henning B

03/29/2021, 2:21 PM
not aware of that, trying it now
Works wonderful 🙇‍♂️ Thank so much for the fast help I learn something new everyday 🙂
g

gammax

03/29/2021, 2:30 PM
Nice 🙂
3 Views