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

Ktlint rule for disabling Import ordering is not honored #582

Closed
sp00ne opened this issue May 27, 2020 · 1 comment
Closed

Ktlint rule for disabling Import ordering is not honored #582

sp00ne opened this issue May 27, 2020 · 1 comment

Comments

@sp00ne
Copy link

sp00ne commented May 27, 2020

Issue

The issue at hand is that java imports are placed erroneously when autoformatting in the IDE. As a result, ktlint has exposed a linting option of disabling the import-order rule through .editorconfig:

disabled_rules = import-ordering

For reference see: pinterest/ktlint#527
Spotless however, does not honor this and throws exception when running the check.

.editorConfig

# https://github.com/shyiko/ktlint#editorconfig

root = true

[*.{kt,kts,xml}]
indent_style = space
indent_size = 4
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true

[*.{kt,kts}]
max_line_length = 165
disabled_rules = import-ordering # Added because IDEA does not respect alphabetical ordering (https://github.com/JetBrains/kotlin/pull/3336)

Stack trace from spotlessCheck

> The following files had format violations:
      app/src/main/java/com/sl/slbiljetter/util/extensions/LiveDataExtensions.kt
          @@ -7,16 +7,16 @@
           import·androidx.lifecycle.Observer
           import·androidx.lifecycle.asFlow
           import·androidx.lifecycle.asLiveData
          +import·java.util.concurrent.CountDownLatch
          +import·java.util.concurrent.TimeUnit
          +import·java.util.concurrent.TimeoutException
          +import·kotlin.math.roundToLong
           import·kotlinx.coroutines.CoroutineDispatcher
           import·kotlinx.coroutines.Dispatchers
           import·kotlinx.coroutines.delay
           import·kotlinx.coroutines.flow.debounce
           import·kotlinx.coroutines.flow.flatMapConcat
           import·kotlinx.coroutines.flow.flow
          -import·java.util.concurrent.CountDownLatch
          -import·java.util.concurrent.TimeUnit
          -import·java.util.concurrent.TimeoutException
          -import·kotlin.math.roundToLong
           

@nedtwigg
Copy link
Member

Duplicate of #142

@nedtwigg nedtwigg marked this as a duplicate of #142 May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants