android/kotlin-guides

Evaluate providing IntelliJ code style configuration

JakeWharton opened this issue ยท 4 comments

Perhaps as a plugin so that it's constantly updating?

If there's interest in this (before we get an auto-updating plugin) I'd be happy to get the base config file up. (it might not have every rule, I'll have to double check what will be supported by default in the code style setup, and if there's any custom intellij code that needs to be written for specific rules.)

I would also be down to write the plugin, but not sure where to host the file.

Could bundle the xml file with the plugin version, but that seems weird.

@scottmeschke myself and @twbarber at Rocket Travel would love to an importable IntelliJ style rule set based on the Android Kotlin style guide (https://android.github.io/kotlin-guides/style.html), if this is something we could help with please reach out to us!

For what it's worth, ktlint --android --apply-to-idea link (--android flag here enables Android Kotlin Style Guide compatibility) aims to provide this.

Not everything described in the https://android.github.io/kotlin-guides/style.html can be configured through Intellij Code Style / Inspections settings but the things that don't are enforced by the ktlint itself (unfortunately not all rules from the style guide are implemented (yet) but we are getting there).

The latest Kotlin plugin now has a Set from -> Predefined Style -> Kotlin style guide option that applies Jetbrains' style guide. Adding another option there would be perfect, but I don't know if there's an API for that...