morning. two questions: - does ktlint check for .*...
# ktlint
j
morning. two questions: - does ktlint check for .* imports vs explicit classes list - does ktlint check for number of spaces before chained methods calls like
Copy code
val x = listOf(1, 2, 3)
                .map { it + 1 }
            .sum()
(on this example, the
.map...
can be set to 16 spaces, but when I add one more space, suddenly it's
Unexpected indentation (17) (it should be 12) (cannot be auto-corrected)
I'm running default config
id("org.jlleitschuh.gradle.ktlint") version "8.2.0"
plugin during ./gradlew build
i
1.
* import
is called
wildcard import
and yes ktlint has
No wildcard imports
rule 2, Yes it does also checks for indents (your error message actually suggests that). Check
Indentation formatting
/
indent size
You can read more on official ktlint page (ktlint tool page, not gradle ktlint plugin page) https://github.com/pinterest/ktlint You can read more on official ktlint page https://github.com/pinterest/ktlint
1. I am not sure, but I think I had to override indent size to match IDE one. Try to add
indent_size = 4
in
.editorconfig
. Here is my smaple project: https://github.com/igorwojda/android-showcase/blob/master/.editorconfig 2. If I remember correctly wildcard import conflicts with
Kotlin Android Extensions
(https://kotlinlang.org/docs/tutorials/android-plugin.html) that generates imports like this
import kotlinx.android.synthetic.main.activity_main.*
. To validate imports I am suing
detekt
which gives more controll and allows to exclude some of the wildcard imports. Check this custom
detekt
config file (my project again): https://github.com/igorwojda/android-showcase/blob/74d425ed7ac9d1f5b247c980db2b6f579b2d125f/config/detekt.yml#L541