Automating Your Android Code Review Process | by Bobby Irawan | Jan, 2022

or part of the process using these tools

Bobby Erawan
Credit by Jason Leung
  1. Standard code enforcement. Working with many people on one project needs some criteria. Implement a static code parser to force the developer to follow the rule.
  2. Reduce bugs and performance issues. Some of the rules already follow the standard guidelines that make our app work better. like use for every And in layout Operate when needed.

According to the official documentation, Ktlint is a Kotlin anti-skid linter with a built-in formatter. There are some rules that are enabled by default when running a Ktlint task, which you can find here. Let’s start integrating it into an Android project.

Step 1, add the Ktlint plugin
Step 2, Add Ktlint Configuration
Step 3, modify the report file directory

Detekt is a static code analyzer. It had the same main function as Ktlint, which is to check your code and report it if there is a violation, but it’s much more powerful, at least to me. Detekt also comes with preset rules that we can easily toggle on and off, for full rules check them out here.

Step 1, add the plugin to the project
Step 2, add the Detekt plugin configuration
Step 3 Check the Gradle task available for Detekt

The main role of static code analysis is to help us take care of issues like code convention, code performance, etc.

Leave a Comment