Skip to content

Rule 3.5: Use spaces for indentation, indenting is equal to 4 spaces #62

@orchestr7

Description

@orchestr7

May be you can look if it is already done in ktlint-standard? If yes - simply inherit it with customizations

Only spaces are allowed for indentation and each indentation should equal to 4 spaces (tabs are not allowed).
In case you prefer using tabs - just simply configure auto change of tabs to spaces in your IDE.
Exceptions:

  1. When breaking parameter list of a method/class constructor it can be aligned with 8 spaces or a parameter that was moved to a newline can be on the same level as the previous argument:
class Class(propertiesFileName: String,
            otherName: String) {

or

fun visit(
        node: ASTNode,
        autoCorrect: Boolean,
        params: KtLint.Params,
        emit: (offset: Int, errorMessage: String, canBeAutoCorrected: Boolean) -> Unit
) {
  1. Operators like +/-/*/e.t.c can be indented with 8 spaces:
val abcdef = "my splitted" +
                " string"

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestepicMajor feature, could be decomposed into smaller tasks

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions