KT.IMPORT_ORDERING

Imports in non default order

Import ordering is configured via the import ordering "layout" parameter. Supported values: - ",java.,javax.,kotlin.,^" - default IntelliJ IDEA's order - "" - alphabetical order as recommended in Android's Kotlin style guide - custom - defined by the following set of tokens. Tokens can be combined together in a group, groups/tokens must be comma separated: - "" - wildcard symbol, can be used as follows: -- Single, meaning matching any import -- After an import path, e.g. "java." or "kotlin.io.Closeable." -- Doubled after an import path, e.g. "java." or "kotlin.io.", meaning "with subpackages" - "|" - blank line symbol. Only supported single blank lines between imports. Multiple blank lines will be ignored. Blank lines are not allowed outside of import list. - "^" - alias symbol, can be used as follows: -- In front of an import path, meaning matching all alias imports from this path, e.g. "^android." -- Alone, meaning matching any alias import - "^" - import paths - these can be full paths, e.g. "java.util.List." as well as wildcard paths meaning "with subpackages", e.g. "kotlin.*"

Options

  • layout (default: *,java.**,javax.**,kotlin.**,^)

    the import ordering layout

The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html