Search code examples
android-studiokotlinktlint

How to configure ktlint gradle plugin in a continuous mode?


In my Android Studio app project, I've integrated ktlint gradle.

Is it possible to configure the ktlint gradle plugin, so that it runs continuously on the fly (while coding on the keyboard)?? Like ESlint is used for JS, it warns me immediately if any lint warnings occur..


Solution

  • It is not possible to do that. klint is not a static analysis tool.

    Alternatively, you can write custom lint rules for the same. Here are some resources for doing so:

    1. Android Dev summit 2018 talk
    2. Android Dev summit 2019 talk
    3. Android source code for standard lint rules
    4. Repos
      1. https://github.com/googlesamples/android-custom-lint-rules
      2. https://github.com/tikurahul/lint-experiments
      3. https://github.com/vanniktech/lint-rules