19

I am really loving to code android apps in Kotlin recently - but I really miss lint. Anyone knows how to get this back ( at least partially ). Is there a project that adapts the android java lint rules to kotlin? AFAIK lint is not running on bytecode only so there needs to be some manual converting to be done. My main pain-point at the moment is that I need a compile-time error when I use a function < MINSDK level Can someone point me in the right direction?

ligi
  • 39,001
  • 44
  • 144
  • 244
  • 1
    Many of the link checks work against java *source* code. You'll just not get that with Kotlin source unless someone ports all the lint tools to Kotlin. – Doug Stevenson Feb 24 '16 at 05:27

3 Answers3

20

The Kotlin team is working on supporting Android Lint checks for Kotlin code. You can watch this issue to keep track of the progress.

yole
  • 92,896
  • 20
  • 260
  • 197
  • Thanks - this was what I was searching for - just voted for this issue and hope it gets solved soon so I can migrate more code to kotlin – ligi Feb 24 '16 at 07:57
  • Follow-up: Kotlin 1.0.2 now has initial lint-checks – ligi May 25 '16 at 07:56
8

In the release of Android Studio 3.2, Lint can able to check.

Follow below step to enable lint check for Kotlin:

  • To enable these checks, go to File > Preferences > Editor > Inspections and check the rules that you want to enable under Kotlin Interoperability, as shown below.

  • You can then run the checks by selecting Analyze > Inspect Code from the main menu.

Check more info at Lint checks for Java/Kotlin interoperability

Lint checks for Java/Kotlin interoperability

I hope it helps us.

Community
  • 1
  • 1
pRaNaY
  • 24,642
  • 24
  • 96
  • 146
4

There is a Kotlin linter that has a few different ways of integrating it with different build systems.

https://github.com/shyiko/ktlint

Jonathan Leitschuh
  • 822
  • 1
  • 8
  • 29