Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
akuleshov7 opened this issue Jul 10, 2020 · 0 comments · Fixed by #75
Closed

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

akuleshov7 opened this issue Jul 10, 2020 · 0 comments · Fixed by #75
Assignees
Labels
enhancement New feature or request epic Major feature, could be decomposed into smaller tasks
Projects
Milestone

Comments

@akuleshov7
Copy link
Member

akuleshov7 commented Jul 10, 2020

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"
@petertrr petertrr self-assigned this Jul 10, 2020
@petertrr petertrr added the enhancement New feature or request label Jul 10, 2020
@petertrr petertrr added this to To do in diKTat via automation Jul 10, 2020
@akuleshov7 akuleshov7 removed this from To do in diKTat Jul 10, 2020
@akuleshov7 akuleshov7 added the epic Major feature, could be decomposed into smaller tasks label Jul 10, 2020
@petertrr petertrr self-assigned this Jul 10, 2020
@petertrr petertrr added this to To do in diKTat via automation Jul 10, 2020
@petertrr petertrr moved this from To do to In progress in diKTat Jul 10, 2020
petertrr added a commit that referenced this issue Jul 22, 2020
# Conflicts:
#	diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt
#	diktat-rules/src/main/resources/rules-config.json
#	info/available-rules.md
petertrr added a commit that referenced this issue Jul 22, 2020
# Conflicts:
#	diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt
#	diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt
#	diktat-rules/src/main/resources/rules-config.json
#	info/available-rules.md
diKTat automation moved this from In progress to Done tasks Jul 27, 2020
@petertrr petertrr added this to the Chapter 3 milestone Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request epic Major feature, could be decomposed into smaller tasks
Projects
No open projects
diKTat
  
Done tasks
Development

Successfully merging a pull request may close this issue.

2 participants