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.

Active by default: No

AnnotationSpacing

See ktlint-website for documentation.

Active by default: No

ArgumentListWrapping

See ktlint-website for documentation.

Active by default: No

Configuration options:

  • indentSize (default: 4)

    indentation size

  • maxLineLength (default: 120) (android default: 100)

    maximum line length

ChainWrapping

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

CommentSpacing

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

EnumEntryNameCase

See ktlint-website for documentation.

Active by default: No

Filename

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

FinalNewline

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

Configuration options:

  • insertFinalNewLine (default: true)

    report absence or presence of a newline

ImportOrdering

See ktlint-website for documentation.

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

Active by default: Yes - Since v1.19.0

Configuration options:

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

    the import ordering layout

Indentation

See ktlint-website for documentation.

Active by default: Yes - Since v1.19.0

Configuration options:

  • indentSize (default: 4)

    indentation size

  • continuationIndentSize (default: 4)

    continuation indentation size

MaximumLineLength

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

Configuration options:

  • maxLineLength (default: 120) (android default: 100)

    maximum line length

  • ignoreBackTickedIdentifier (default: false)

    ignore back ticked identifier

ModifierOrdering

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

MultiLineIfElse

See ktlint-website for documentation.

Active by default: No

NoBlankLineBeforeRbrace

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

NoConsecutiveBlankLines

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

NoEmptyClassBody

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

NoEmptyFirstLineInMethodBlock

See ktlint-website for documentation.

Active by default: No

NoLineBreakAfterElse

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

NoLineBreakBeforeAssignment

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

NoMultipleSpaces

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

NoSemicolons

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

NoTrailingSpaces

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

NoUnitReturn

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

NoUnusedImports

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

NoWildcardImports

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

PackageName

See ktlint-website for documentation.

Active by default: No

ParameterListWrapping

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

Configuration options:

  • indentSize (default: 4)

    indentation size

  • maxLineLength (default: 120) (android default: 100)

    maximum line length

SpacingAroundAngleBrackets

See ktlint-website for documentation.

Active by default: No

SpacingAroundColon

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

SpacingAroundComma

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

SpacingAroundCurly

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

SpacingAroundDot

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

SpacingAroundDoubleColon

See ktlint-website for documentation.

Active by default: No

SpacingAroundKeyword

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

SpacingAroundOperators

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

SpacingAroundParens

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

SpacingAroundRangeOperator

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0

SpacingAroundUnaryOperator

See ktlint-website for documentation.

Active by default: No

SpacingBetweenDeclarationsWithAnnotations

See ktlint-website for documentation.

Active by default: No

SpacingBetweenDeclarationsWithComments

See ktlint-website for documentation.

Active by default: No

StringTemplate

See ktlint-website for documentation.

Active by default: Yes - Since v1.0.0