https://kotlinlang.org logo
#android
Title
# android
t

Tarun

03/09/2018, 9:28 AM
Android Studio also has one default one. Android studio provides a code style tool which can be customised and exported to be distributed to teams. Path to get this tool is Android Studio -> Preferences -> Editor -> Code Style -> Kotlin Default code style is present which follows https://android.github.io/kotlin-guides/style.html
j

jasonlow

03/09/2018, 9:41 AM
@Tarun Yeah, at the time the default android linter did not support Kotlin yet (i believe). Have you personally tried it? Is it decent?
t

Tarun

03/09/2018, 9:49 AM
yes it is descent but not perfect, hence I also use two tools : one is default and one is KTLint lets see if anyone has used any different tool
j

jasonlow

03/12/2018, 7:20 AM
Sry for the late reply @Tarun, but how did you configure linting with both AS linter and Ktlint?
t

Tarun

03/12/2018, 7:29 AM
Android Studio code style tool is already enabled by default for Kotlin enabled projects(as can be seen @Android Studio -> Preferences -> Editor -> Code Style -> Kotlin) and highlights errors as warning in light yellow color. We can enable disable check here just by unchecking the checkbox. FOr Ktlint we have to follow steps given in Usage section of @ https://github.com/shyiko/ktlint and this has to be executed manually(as against AS which runs automatically) by some command which is for example : "gradle ktlint" for gradle. so both works simultaneously
j

jasonlow

03/12/2018, 8:23 AM
Thanks very much buddy, will see if this works for me. Thank you again!
2 Views