How to configure ktlint gradle plugin in a continuous mode?

Issue

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

Answered By – Xid

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published