question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot disable multiline-if-else rule

See original GitHub issue

i tried to disable said rule through the configuration of my build file however adding it to the disabledRules had no effect.

ktlint {
    enableExperimentalRules.set(true)
    disabledRules.set(
        setOf(
            "multiline-if-else",
            "comment-spacing",
            "curly-spacing",
            "keyword-spacing",
            "no-wildcard-imports"
        )
    )
}

im still gettting Missing { ... } messages in the console and after checking the source code of ktlint, those are coming from multiline-if-else

im using version 9.3.0 of this plugin

the report can be found here

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
LordMZTEcommented, Aug 14, 2020

it looks like the issue was that i had to specify experimental:multiline-if-else insead of multiline-if-else with this changed, everything works as expected

0reactions
LordMZTEcommented, Aug 12, 2020

the build script i took this from is here (with the difference that the rule isn’t in the disabled rules as it didnt do anything. but adding the experimental enable and the ignore line there will result in an exact copy of the build script i got this issue in)

Read more comments on GitHub >

github_iconTop Results From Across the Web

ktlint's multiline-if-else rule not fixed automatically #1264
Task :spotlessKotlin FAILED Step 'ktlint' found problem in 'app/src/main/java/com/example/todoapp/MainActivity.kt': Error on line: 20, ...
Read more >
Remove rules
Remove rules. If you want to change the behavior of styler to match your desired style, there are multiple ways: Use the tidyverse...
Read more >
Formatting Rule Set | Detekt
This rule set provides wrappers for rules implemented by ktlint ... Note: The formatting rule set is not included in the detekt-cli or...
Read more >
Static Analysis Tools - ktlint - The Android Arsenal
To disable a specific rule you'll need to turn on the verbose mode ( ktlint --verbose ... ). At the end of each...
Read more >
Styling multi-line conditions in 'if' statements? - Stack Overflow
Moreover, the new rule is that the and and or statements should start on the next line ... P.s. I am not an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found