pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.06k stars 504 forks source link

False positive for indentation in a nested lamba #2624

Closed diklimchuk closed 2 months ago

diklimchuk commented 2 months ago

Expected Behavior

No issues

Observed Behavior

Unexpected indentation (8) (should be 12) [Indentation]
Missing newline after "{" [Wrapping]

Steps to Reproduce

I run detekt with ktlint on the following code:

@Composable
internal fun tmp(): (Boolean) -> Unit = remember {
    { argument ->
        Unit
    }
}

Your Environment

paul-dingemans commented 2 months ago

detekt "1.23.5" is not a valid ktlint version.

Also, I need more information about how ktlint is configured. With .editorconfig below Ktlint 1.1.1 and 1.2.1 both do not reproduce the issue:

[*.{kt,kts}]
ktlint_code_style = ktlint_official
ktlint_standard_function-signature = disabled
ktlint_standard_multiline-expression-wrapping = disabled

Most likely you can better start with creating an issue in the Detekt project as they know how Detekt integrates with ktlint.

paul-dingemans commented 2 months ago

Can not be reproduced. OP has not provided additional information.