I have an android project in Android studio that I would like to use detekt as a static code analyzer. I can run detekt through a gradle task and I am able to queue it up before the run of the app by using the Android run configurations, but I cannot seem to get it to stop the run if the task returns an error code.
I have detekt running from the command line in my build pipeline, but I would like the developer to also fail their run on their development machine.
Turns out the solution was to add the gradle task in all the files. In my case I needed to add a top level gradle file for detekt. 'detekt.gradle'
Then in the main gradle file I have
Then in each module gradle file I put:
This makes every build of the modules run detekt first and if detekt fails the build will not complete.