1

I have a class written in kotlin. When I right click on the class.kt and press the Analyze->Inspect Code, I do get the kotlin warnings.

If I run from the command line ./gradlew lint, I don t see the class.kt warnings. I do see other warnings, but no Kotlin warnings Is there anything I m missing from the command line?

I am using Android Sudio 3.1

just ME
  • 1,817
  • 6
  • 32
  • 53
  • Possible duplicate of [Kotlin and android lint checks](https://stackoverflow.com/questions/35590455/kotlin-and-android-lint-checks) – WoogieNoogie Apr 17 '18 at 15:04
  • 1
    The answer is, Kotlin checks are not part of the lint plugin yet, but they are building it in. The answer is in the above linked question. – WoogieNoogie Apr 17 '18 at 15:05
  • I see. Thx, If it's build in Android Studio 3.1...how can I run from command line the Analyze->Inspect Code in order to see the warnings/erros results from class.kt ? – just ME Apr 17 '18 at 15:10
  • I don't know which to recommend, but do a quick search for a kotlin gradle lint plugin. There are a few options out there. That will add a kotlin lint step to your builds. – WoogieNoogie Apr 17 '18 at 15:11
  • but Analyze->Inspect Code isn't running inspect.sh? did you try to use this from cmd line – just ME Apr 17 '18 at 15:13

1 Answers1

1

There are two distinct sets of code checks: Android-specific lint checks built by Google, and general Kotlin code inspections built by JetBrains.

Analyze | Inspect Code shows you the results of running both sets of checks: the code inspections are "native" to IntelliJ IDEA, and the Android lint checks have been integrated into IntelliJ IDEA by the Android tools team.

Running ./gradlew lint runs only the Android-specific lint checks. They did add the possibility to handle Kotlin code to these checks in recent versions of Android Studio, but they still check only for Android-specific issues, not general problems with Kotlin code.

If you want to run IntelliJ IDEA's checks from the command line, you can either use inspect.sh as described in IntelliJ IDEA documentation, or you can use the experimental Gradle plugin for running IntelliJ IDEA inspections that JetBrains is working on. Note that the plugin will not run as part of ./gradlew lint; you'll need to run a separate Gradle task to run its inspections.

yole
  • 92,896
  • 20
  • 260
  • 197