Skip to main content

Kotlin - Coding Conventions



The official Kotlin style guide has been published at kotlinlang.org

Kotlin Official Coding Conventions

For those not familiar with style guides, it provides best practices & recommendations for a language's naming rules, formatting, documentation, etc. It can make your source deliverables much more consistent, readable, and efficient.  When working with other developers it becomes important to follow some level of coding standards that can be enforced through code reviews.

If you use IntelliJ IDEA for your Kotlin development, there is a formatter available that matches the published style guide.  This assists with the coding conventions while developing in IntelliJ IDEA.

1. Install the Kotlin plugin version 1.2.20-eap-33 or newer

     Kotlin Plugins

2. From IntelliJ menu, navigate using

     File -> Settings-> Editor -> Code Style -> Kotlin

3. Use the "Set from" link and select

     "Predefined style" -> "Kotlin style guide"


I've installed the formatter using the steps above, and so far so good!

Enjoy and until next time ...

Comments