Skip to content

import-ordering

Kotlinstyleno fixdefault: offkotlin/ktlint

Reports an import list that the formatter would reorder or rewrite.

Imports in a fixed order make it easy to find one, and two developers who add an import in the same place do not conflict.

To fix, run the formatter.

Reported
import b.B
import a.A
...
1 -> {
...
After the fix
import b.B
import a.A
...
1 -> {
...
kotlin:
lint:
rules:
import-ordering: warn # off (default), warn, error

Enabled by the presets: kotlin/ktlint.

Suppress one line with sudsy-disable-next-line import-ordering in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ktlint import-ordering full