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

Indentation rule change in 0.40.0 #1012

Closed
jai opened this issue Dec 15, 2020 · 2 comments
Closed

Indentation rule change in 0.40.0 #1012

jai opened this issue Dec 15, 2020 · 2 comments
Labels

Comments

@jai
Copy link

jai commented Dec 15, 2020

cc @umbertosidoti @theerasan

Hi - it seems that this is new in 0.40.0, and I think it may be related to:

Any info or guidance would be appreciated. Have considered creating our own ruleset but wanted to understand why this is happening first.

Expected Behavior

Indentation indent error shouldn't be triggered (ktlint should pass) for these lines:

class ApplyEmailViewModel @Inject constructor(
    viewModelExecutor: ViewModelExecutor,
    private val navigator: MainNavigator,
    private val interactor: EmailInteractor,
    private val viewStateMapper: EmailToEmailViewStateMapper,
    private val analytics: ApplyEmailAnalytics
) : BaseViewModelEventLiveData<
    ApplyEmailViewState,       # Line 22
    ApplyEmailEvent.              # Line 23
    >(viewModelExecutor),    # Line 24
    FormFieldListener {

Observed Behavior

ktlint fails with errors:

/Users/jai/Developer/android-app/presentation/apply-presentation/src/main/kotlin/com/honestbank/android/apply/presentation/email/ApplyEmailViewModel.kt:22:1: Unexpected indentation (4) (should be 8) (indent)
/Users/jai/Developer/android-app/presentation/apply-presentation/src/main/kotlin/com/honestbank/android/apply/presentation/email/ApplyEmailViewModel.kt:23:1: Unexpected indentation (4) (should be 8) (indent)
/Users/jai/Developer/android-app/presentation/apply-presentation/src/main/kotlin/com/honestbank/android/apply/presentation/email/ApplyEmailViewModel.kt:24:1: Unexpected indentation (4) (should be 8) (indent)

Steps to Reproduce

Here's the code:

class ApplyEmailViewModel @Inject constructor(
    viewModelExecutor: ViewModelExecutor,
    private val navigator: MainNavigator,
    private val interactor: EmailInteractor,
    private val viewStateMapper: EmailToEmailViewStateMapper,
    private val analytics: ApplyEmailAnalytics
) : BaseViewModelEventLiveData<
    ApplyEmailViewState,
    ApplyEmailEvent
    >(viewModelExecutor),
    FormFieldListener {

    init {
        compositeDisposable.add(
            interactor.emailListenable.listen(false) {
                onEmailUpdated(it)
            }
        )
    }
}

Your Environment

  • Version of ktlint used: 0.40.0 (vs 0.39.0)
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): just plain old ktlint and ktlint --verbose
  • Version of Gradle used (if applicable): N/A
  • Operating System and version: macOS Big Sur
  • Link to your project (if it's a public repository): N/A
@jai
Copy link
Author

jai commented Dec 15, 2020

Here's conflicting output between ktlint 0.39.0 and 0.40.0 (the first run is from 0.40.0):

(⎈ |test-api:default)❯ ktlint --verbose
/Users/jai/Developer/android-app/presentation/apply-presentation/src/main/kotlin/com/honestbank/android/apply/presentation/email/ApplyEmailViewModel.kt:22:1: Unexpected indentation (4) (should be 8) (indent)
/Users/jai/Developer/android-app/presentation/apply-presentation/src/main/kotlin/com/honestbank/android/apply/presentation/email/ApplyEmailViewModel.kt:23:1: Unexpected indentation (4) (should be 8) (indent)
/Users/jai/Developer/android-app/presentation/apply-presentation/src/main/kotlin/com/honestbank/android/apply/presentation/email/ApplyEmailViewModel.kt:24:1: Unexpected indentation (4) (should be 8) (indent)

~/Developer/android-app card_info*
(⎈ |test-api:default)❯ ./ktlint --version
0.39.0

~/Developer/android-app ci-add-custom-ktlint*
(⎈ |test-api:default)❯ ./ktlint --verbose
/Users/jai/Developer/android-app/presentation/apply-presentation/src/main/kotlin/com/honestbank/android/apply/presentation/email/ApplyEmailViewModel.kt:22:1: Unexpected indentation (8) (should be 4) (indent)
/Users/jai/Developer/android-app/presentation/apply-presentation/src/main/kotlin/com/honestbank/android/apply/presentation/email/ApplyEmailViewModel.kt:23:1: Unexpected indentation (8) (should be 4) (indent)
/Users/jai/Developer/android-app/presentation/apply-presentation/src/main/kotlin/com/honestbank/android/apply/presentation/email/ApplyEmailViewModel.kt:24:1: Unexpected indentation (8) (should be 4) (indent)

@Tapchicoma Tapchicoma added the bug label Dec 15, 2020
@romtsn
Copy link
Collaborator

romtsn commented Dec 19, 2020

@jai I wasn't able to reproduce this on master, could you give it a try with the latest snapshot?

@romtsn romtsn closed this as completed Jan 20, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants