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

Indentation violation for property delegates #939

Closed
chao2zhang opened this issue Oct 6, 2020 · 0 comments · Fixed by #952
Closed

Indentation violation for property delegates #939

chao2zhang opened this issue Oct 6, 2020 · 0 comments · Fixed by #952
Labels

Comments

@chao2zhang
Copy link
Contributor

Expected Behavior

package com.chaozhang.testktlint

class LongLongLongLongLongLongLongLongLongLongLongLongLongLongName

class UsingPropertyDelegate {
    val a: LongLongLongLongLongLongLongLongLongLongLongLongLongLongName
        by lazy { LongLongLongLongLongLongLongLongLongLongLongLongLongLongName() }
}

Should pass the indentation check as this is using the recommended code style setting in Android Studio.
And also this makes sense, because by is a continuation.

Observed Behavior

/Users/cazhang/TestKtLint/app/src/main/java/com/chaozhang/testktlint/PropertyDelegate.kt:7:1: Unexpected indentation (8) (should be 4)

And the code would be auto corrected to

class UsingPropertyDelegate {
    val a: LongLongLongLongLongLongLongLongLongLongLongLongLongLongName
    by lazy { LongLongLongLongLongLongLongLongLongLongLongLongLongLongName() }
}

Steps to Reproduce

Copy-paste the snippet and run ktlint.

Your Environment

  • Version of ktlint used: 0.39.0
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): custom gradle task
  • Version of Gradle used (if applicable): 6.5
  • Operating System and version: MacOS 10.15.6
  • Link to your project (if it's a public repository): https://gist.github.com/chao2zhang/8a445a3b327c307142e6027ffb691177
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants