Is there any way to disable a rule based on a supe...
# ktlint
p
Is there any way to disable a rule based on a supertype? We use #kotest heavily however since
1.3.0
the
class-signature
rule (intellij style) is changing all our
Copy code
class MySpec : FreeSpec({
    "test something" {
        1 shouldBeGreaterThan 0
    }
})
to the horribly over-indented
Copy code
class MySpec :
    FreeSpec({
        "test something" {
            1 shouldBeGreaterThan 0
        }
    })
obviously this is an edgecase on the intended use of the rule, but it's fairly common with kotest. For now, I'm thinking the best solution is to disable the rule only for
src/test/kotlin/**/*.kt
d
I don't think there is currently an option, but I'm interested in making it more configurable. You could reply to this discussion: https://github.com/pinterest/ktlint/discussions/2711 If this is a breaking change in
1.3.0
, it might be worth opening an issue. But in the short term, I think what you suggested about disabling the rule for test source sets makes sense as a work-around.
❤️ 1