I expect the following to pass formatting.
json(jsonString = """{ "id": "1234" }""")
Fails with: Missing newline after "=" (indent)
fun json(jsonString: String?) {
TODO()
}
fun exampleThatFailsKtLint() {
json(jsonString = """{ "id": "1234" }""")
}
fun exampleThatPassesKtLint() {
// Android Studio formatting will move this back to next example, which will fail ktlint
json(
jsonString =
"""{ "id": "1234" }"""
)
}
fun exampleThatFailsKtLintWhichAndroidStudioAutoFormatsTo() {
json(
jsonString =
"""{ "id": "1234" }"""
)
}
fun exampleThatPassesLint() {
// lacks named parameter
json(
"""{ "id": "1234" }"""
)
}
fun exampleThatPassesLint2() {
// lacks named parameter
json("""{ "id": "1234" }""")
}
0.38.1 (command line)4.0.1 with AGP 3.6I also tried disabling this but it did not seem to work?
/* ktlint-disable indent */
json(jsonString = """{ "taskReferenceId": "1234" }""")
/* ktlint-enable indent */
I added this line.
import android.view.* // ktlint-disable no-wildcard-imports
Without the comment, I saw Wildcard import (cannot be auto-corrected) (no-wildcard-imports). After adding the comment, the error was suppressed. Seems like there is an issue with disabling the indent rule? I also checked with:
/* ktlint-disable no-wildcard-imports */
import android.view.*
/* ktlint-enable no-wildcard-imports */
Which worked as expected.
This is a separate issue probably
I could not reproduce your issue with build from current master. Most probably it was fixed via #711 issue.
Please open a separate issue regarding "indent" rule disabling is not working.
Yeah this is fixed already on master. Disabling the indent rule is also not possible at the moment as it runs all or nothing (only possible for the entire file), gonna be possible after we split it as mentioned in #764. Please look for the next release, we are planning to release 0.39.0 soon