Closed kasingal closed 4 years ago
Google Kotlin Style Guide
To be clear, Google's Kotlin style guide does not make any exceptions for java
or javax
. They are subject to regular ordering like any other package.
@JakeWharton I agree, but IntelliJ (with default Kotlin Style Guide) is not formatting code in same way as ktlint is formatting.
As Intellij auto add required import statements and doesn't keep java or javax related imports in lexicographic order, which makes process tedeous to always run ktlint format on codebase.
Either there should be some .editorConfig which alligns with all ktlint rules, same can be imported to IntelliJ so that it doesn't handle java or javax imports in different way.
Closing as duplicate of #527
https://github.com/pinterest/ktlint/blob/bc08930a1f0848e7ee774b24512ba6ae4e25e9be/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/ImportOrderingRule.kt#L36
Using Intellij with Google Kotlin Style Guide (https://github.com/pinterest/ktlint#-with-intellij-idea)
When running Reformat Code (*.kt) by default java. or javax. related import statements comes in last after other import statements and ImportOrderingRule always fails to validate same.
ImportOrderingRule should skip lexicographic order on import statements starting from java or javax