Kotest <https://kotest.io/docs/framework/framework...
# ktlint
k
Kotest uses following format for defining specs (tests):
Copy code
class MyTests : StringSpec({
   "length should return size of string" {
      "hello".length shouldBe 5
   }
})
Kotest (standard ruleset) formats it as following:
Copy code
class MyTests : StringSpec(
  {
    "length should return size of string" {
      "hello".length shouldBe 5
    }
  },
)
How do I prevent it from add a newline for the spec body lambda here? I see there was already this ticket for this from 4 years ago but curious if there's a solution here? What's the rule controlling this behavior?
e
I think it's multiline-expression-wrapping that causes the issue. You can disable it by adding this to your
.editorconfig
Copy code
ktlint_standard_string-template-indent = disabled
ktlint_standard_multiline-expression-wrapping = disabled
k
Already have both disabled
I think it's the trailing comma at the call site actually
ij_kotlin_allow_trailing_comma_on_call_site = false
disabling this fixes it
💯 1
e
ah..
k
Is there a way to make trailing commas at callsite optional? That is, they don't get added automatically but they don't get removed either.
It's nice to have in most cases, but I guess I wish it didn't remove the comms even if the rule is disabled
p
No this can not be configured. Either you choose to use them always, or never. Ktlint is more restrictive in this then default formatter of Intellij IDEA.
k
Unfortunate! Thanks