Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Conflicting constructor argument indentation requirements for class with linewrapping type list #921

Closed
mathjeff opened this issue Sep 22, 2020 · 1 comment · Fixed by #950

Comments

@mathjeff
Copy link

We have some code that looks like this:

class ComposableLambda<
    P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16,
    P17, P18, R>(
    val key: Int,
    private val tracked: Boolean,
    private val sourceInformation: String?
)

We we run ./gradlew ktlint with ktlint version 0.39.0, it fails, saying that we need to indent these last four lines by 4 characters each:

ComposableLambda.kt:50:5: Unexpected indentation (expected 8, actual 4)
ComposableLambda.kt:51:5: Unexpected indentation (expected 8, actual 4)
ComposableLambda.kt:52:5: Unexpected indentation (expected 8, actual 4)
ComposableLambda.kt:53:1: Unexpected indentation (expected 4, actual 0)

Then we make those changes:

class ComposableLambda<
    P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16,
    P17, P18, R>(
        val key: Int,
        private val tracked: Boolean,
        private val sourceInformation: String?
    )

it fails again, asking us to undo those changes:

ComposableLambda.kt:50:1: Unexpected indentation (8) (should be 4)
ComposableLambda.kt:51:1: Unexpected indentation (8) (should be 4)
ComposableLambda.kt:52:1: Unexpected indentation (8) (should be 4)
ComposableLambda.kt:53:1: Unexpected indentation (4) (should be 0)

Expected Behavior

Whichever indendation ktlint expects, it should accept the indentation that it asks for

Observed Behavior

We haven't been able to find an indentation that ktlint will accept

Your Environment

We're observing this when upgrading from ktlint 0.36.0 to 0.39.0

The complete code in question:

https://android.googlesource.com/platform/frameworks/support/+/7f584eb57aae1bf6513e390117ecd66f16dde2a7/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/ComposableLambda.kt#47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants