
configĭetekt needs a configuration file (detekt.yml by default) in order to follow your guidelines. Using detektPlugins "io.:detekt-formatting:1.16.0" is optional, but it will give you additional formatting checks and autoCorrect from ktlint, which is very useful in my opinion. Therefore I thought it would be beneficial to share a gist of the Groovy adle setup with you: But in projects with multiple modules, I found it hard to implement it so easily. detektAllĬonfiguring basic setup for detekt is a pretty straightforward task, as documentation provides clear steps on how to do it. “A static code analysis tool for the Kotlin programming language.” - in other words if your code has errors, bugs, stylistic, formatting errors, you will see an error with description. Multi-module detekt setup What is detekt? In the third part, I will talk about practical use-cases and some hints to use them daily. The second part is about the initial setup that every developer needs to do locally in order to use detekt. The first part will give you Gradle setup for detekt in a multi-module android project. Feel free to use it as documentation inside your project, to speed up using linter by new developers. To make it easier to pass knowledge about using it I wrote this article. config = files(file("$project.rootDir/tools/detekt.Recently I was configuring detekt in a multi-module project.

gradlew detekt after commenting anycodings_android out following line in adle.

Generated html report shows anycodings_android no findings, but the metrics are shown. anycodings_android But code is not formatted when I ran anycodings_android. I have also anycodings_android enabled autoCorrect in detekt-baseline.yml. Id "io." version "1.0.0-RC16"Īs you can see I have added detekt plugin anycodings_android for formatting in adle. I am using detekt with ktlint for formatting anycodings_android my code is like below.īaseline = file("$/tools/detekt-baseline.xml")Ĭonfig = files(file("$project.rootDir/tools/detekt.yml"))ĭetektPlugins "io.:detekt-formatting:$toolVersion"
