https://kotlinlang.org logo
#ktlint
Title
# ktlint
j

Jaehwa Noh

04/02/2024, 11:31 PM
Hello, I have a question. What is editorconfigOverride "android" to "true"? While I am using Ktlint with Spotless, sometimes I see this gradle configuration. What is the meaning of "android" to "true"? I can't see any documentation but developers use this map. What is this? Is there any documentation?
Copy code
ktlint(ktlintVersion).editorConfigOverride(
                    mapOf(
                        "android" to "true",
                    ),
                )
I also asked this at Spotless, but they says It is relative with Ktlint so that I am here.
1
which is deprecated, see newer docs
j

Jaehwa Noh

04/03/2024, 4:50 AM
Thank you, This is what I've searched documentation.
Wait, I wonder editorConfig is working as command line's flag? My code use editorConfigOverride to override editorconfig, but your link shows command line's flag, so I'm not sure both of them is same.
w

wakingrufus

04/03/2024, 1:42 PM
that question should go back to spotless, how it translates its config to the actual ktlint call. in ktlint-gradle, we have the "android" flag as a separate extension property from "additionalEditorconfig"
e

ephemient

04/03/2024, 1:47 PM
there's a new editorconfig field now, so regardless of how
"android"
is handled, https://pinterest.github.io/ktlint/latest/rules/code-styles/
w

wakingrufus

04/03/2024, 1:48 PM
but thats
ktlint_code_style = android_studio
not
android = true
though right?
honestly, i dont really know what android = true does
e

ephemient

04/03/2024, 1:48 PM
that's what you should use now
w

wakingrufus

04/03/2024, 1:48 PM
ah ok
ill deprecated the old one in ktlint-gradle extension
j

Jaehwa Noh

04/04/2024, 12:18 PM
Is there any documentation relative with old
"android"
editconfig field, not as flag?
p

Paul Dingemans

04/04/2024, 1:53 PM
In very old versions of ktlint cli the 'android' parameter was supported. I think it was also supported in '.editorconfig'. But as said by others it is not used anymore. The ktlint documentation is versioned so checkout the older versions. If it is not the oldest version, please see ktlint release notes.
j

Jaehwa Noh

04/05/2024, 2:29 PM
Okay, I got it. Thank you for answering @ephemient, @wakingrufus, @Paul Dingemans
2 Views