Detekt is a static code analysis tool for Kotlin. It can analyze your Kotlin projects for various types of code smells. The tool contains rules for style, performance and potential bugs. The tool is fully configurable so that you may turn off and set thresholds for these rules. It is also extensible so that you could create your own custom rules from your style guide. This tool goes a long way to enforcing good practices in your code base.

Under the hood, the library performs checks against these rules by analyzing the abstract syntax tree provided by the Kotlin Compiler. In this talk, we will learn about how to setup Detekt and how to create custom rules. We will also take a deep dive into how the library enforces these rules by using the abstract syntax tree.