Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin and android lint checks

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?

like image 982
ligi Avatar asked Feb 23 '16 23:02

ligi


People also ask

How do you do lint check on Android?

Lint checks are automatically performed by the Gradle build system. To see the available checks in Android Studio File Settings Editor Inspections. You can also run the lint checks manually by right-clicking on your project and select Analyze Inspect Code. You can run link also from the command line.

What is Kotlin lint?

If you develop in Kotlin, you can find useful to rely on some tools like a lint. If you don't know what it is, Wikipedia's definition for lint is: lint, or a linter, is a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs.

What is lint check in Android?

The lint tool checks your Android project source files for potential bugs and optimization improvements for correctness, security, performance, usability, accessibility, and internationalization. When using Android Studio, configured lint and IDE inspections run whenever you build your app.

What are lint checks?

What Is Linting? Linting is the automated checking of your source code for programmatic and stylistic errors. This is done by using a lint tool (otherwise known as linter). A lint tool is a basic static code analyzer. The term linting originally comes from a Unix utility for C.


2 Answers

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

like image 62
yole Avatar answered Oct 02 '22 05:10

yole


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.

like image 33
pRaNaY Avatar answered Oct 02 '22 06:10

pRaNaY