Edit me

This rule set provides wrappers for rules implemented by ktlint - https://ktlint.github.io/.

Note: Issues reported by this rule set can only be suppressed on file level (@file:Suppress(“detekt.rule”). Note: The formatting rule set is not included in the detekt-cli or gradle plugin.

To enable this rule set, add detektPlugins “io.gitlab.arturbosch.detekt:detekt-formatting:$version” to your gradle dependencies or reference the detekt-formatting-jar with the --plugins option in the command line interface.

AnnotationOnSeparateLine

See ktlint-website for documentation.

AnnotationSpacing

See ktlint-website for documentation.

ArgumentListWrapping

See ktlint-website for documentation.

ChainWrapping

See ktlint-website for documentation.

CommentSpacing

See ktlint-website for documentation.

EnumEntryNameCase

See ktlint-website for documentation.

Filename

See ktlint-website for documentation.

FinalNewline

See ktlint-website for documentation.

Configuration options:

  • insertFinalNewLine (default: true)

    report absence or presence of a newline

ImportOrdering

See ktlint-website for documentation.

For defining custom import layout patterns see: https://github.com/pinterest/ktlint/blob/cdf871b6f015359f9a6f02e15ef1b85a6c442437/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/ImportOrderingRule.kt

Configuration options:

  • layout (default: 'idea')

    the import ordering layout; use ‘ascii’, ‘idea’ or define a custom one

Indentation

See ktlint-website for documentation.

Configuration options:

  • indentSize (default: 4)

    indentation size

  • continuationIndentSize (default: 4)

    continuation indentation size

MaximumLineLength

See ktlint-website for documentation.

Configuration options:

  • maxLineLength (default: 120)

    maximum line length

ModifierOrdering

See ktlint-website for documentation.

MultiLineIfElse

See ktlint-website for documentation.

NoBlankLineBeforeRbrace

See ktlint-website for documentation.

NoConsecutiveBlankLines

See ktlint-website for documentation.

NoEmptyClassBody

See ktlint-website for documentation.

NoEmptyFirstLineInMethodBlock

See ktlint-website for documentation.

NoLineBreakAfterElse

See ktlint-website for documentation.

NoLineBreakBeforeAssignment

See ktlint-website for documentation.

NoMultipleSpaces

See ktlint-website for documentation.

NoSemicolons

See ktlint-website for documentation.

NoTrailingSpaces

See ktlint-website for documentation.

NoUnitReturn

See ktlint-website for documentation.

NoUnusedImports

See ktlint-website for documentation.

NoWildcardImports

See ktlint-website for documentation.

PackageName

See ktlint-website for documentation.

ParameterListWrapping

See ktlint-website for documentation.

Configuration options:

  • indentSize (default: 4)

    indentation size

SpacingAroundColon

See ktlint-website for documentation.

SpacingAroundComma

See ktlint-website for documentation.

SpacingAroundCurly

See ktlint-website for documentation.

SpacingAroundDot

See ktlint-website for documentation.

SpacingAroundDoubleColon

See ktlint-website for documentation.

SpacingAroundKeyword

See ktlint-website for documentation.

SpacingAroundOperators

See ktlint-website for documentation.

SpacingAroundParens

See ktlint-website for documentation.

SpacingAroundRangeOperator

See ktlint-website for documentation.

SpacingBetweenDeclarationsWithAnnotations

See ktlint-website for documentation.

SpacingBetweenDeclarationsWithComments

See ktlint-website for documentation.

StringTemplate

See ktlint-website for documentation.