Hi! I'm noticing different behavior around the `im...
# ktlint
v
Hi! I'm noticing different behavior around the
import-ordering
rule between ktlint and ktlint-gradle (gradle wrapper). Specifically around the ordering of java/javax/kotlin and aliases: ktlint 0.42.1
Copy code
Imports must be ordered in lexicographic order without any empty lines in-between with "java", "javax", "kotlin" and aliases in the end
JLLeitschuh/ktlint-gradle wrapper 10.2.0 using ktlint 0.42.1
Copy code
Imports must be ordered in lexicographic order without any empty lines in-between (import-ordering)
Any idea what could be causing this discrepancy? The gradle wrapper `ktlintCheck`/`ktlintFormat` tasks aren't respecting the latter part of the rule around java/javax/kotlin + alias imports going at the end. Seems to have been added into ktlint around 0.42 based on some closed issues in the repo.
s
i’m not 100% sure how the ktlint-gradle-wrapper plugin passes through those properties
v
hmm, I actually don't have my own custom
.editorconfig
file, so I assume it would just use a default one provided from ktlint?
r
@Vince are you setting
android = true
in the ktlint-gradle configuration? if so, then this is default behavior - android codestyle requires just alphabetical ordering
v
ah, indeed that was the cause (I've configured it to
android = true
). Thanks Roman! and shasha as well 🙂
👍 1
1776 Views