Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unexpected indentation - parameter-list-wrapping expects wrong indentation #415

Closed
KylerWitting opened this issue Dec 3, 2020 · 1 comment

Comments

@KylerWitting
Copy link

I am trying to enable experimental features but running into an issue around parameter formatting. I have the code, error, build.gradle, and the attempted solution below. If I turn off experimental rules there are no more errors thrown but I was not able to disable the rule I believe is causing the issue.

This seems to be the issue getting resolved in 0.39.0 but when I manually specify the version the error persists.

Code:

fun T.exampleFun(first: String, other: String): String {
    return if (first.equals(
            other = other,
            ignoreCase = true
        ) ||
        <SECOND_CONDITIONAL>
    ) {
        first
    } else {
        null
    }
}

Error:

> Task :ktlintMainSourceSetFormat FAILED
/path/to/Example.kt:98:13: Unexpected indentation (expected 8, actual 12)
/path/to/Example.kt:99:13: Unexpected indentation (expected 8, actual 12)
/path/to/Example.kt:100:9: Unexpected indentation (expected 4, actual 8)

build.gradle

plugins {
    id 'org.jlleitschuh.gradle.ktlint' version '9.4.1'
}

ktlint {
    enableExperimentalRules = true
    filter {
        exclude { element -> element.file.path.contains("generated/") }
    }
}

Attempted Solutions

disabledRules = ["experimental:argument-list-wrapping"]
version = "0.39.0"

Working Solution

enableExperimentalRules = false

@Tapchicoma
Copy link
Collaborator

Fix hasn't been yet released and should be in 0.40.0 ktlint version that is planned to be released today.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants