Skip to content

Commit

Permalink
Address ktlint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
romtsn committed Jun 1, 2020
1 parent 6463e80 commit a0512cc
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package com.pinterest.ktlint.ruleset.experimental

import com.pinterest.ktlint.core.KtLint
import com.pinterest.ktlint.core.LintError
import com.pinterest.ktlint.core.Rule
import com.pinterest.ktlint.core.RuleSet
import com.pinterest.ktlint.core.ast.ElementType
import com.pinterest.ktlint.core.ast.ElementType.BLOCK
import com.pinterest.ktlint.core.ast.ElementType.ELSE
import com.pinterest.ktlint.core.ast.ElementType.ELSE_KEYWORD
Expand All @@ -18,7 +14,6 @@ import org.jetbrains.kotlin.com.intellij.psi.PsiWhiteSpace
import org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.LeafPsiElement
import org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.PsiWhiteSpaceImpl
import org.jetbrains.kotlin.psi.KtBlockExpression
import org.jetbrains.kotlin.psi.psiUtil.parents

/**
* https://kotlinlang.org/docs/reference/coding-conventions.html#formatting-control-flow-statements
Expand Down Expand Up @@ -50,7 +45,7 @@ class MultiLineIfElseRule : Rule("multiline-if-else") {
val bodyIndent = node.treePrev.text
val rightBraceIndent = when {
// in case of else if, get the indentation from the first if
node.treeParent.treeParent.elementType == ELSE -> node.parent({ it.elementType == IF && it.treeParent.elementType == BLOCK})!!.treePrev.text
node.treeParent.treeParent.elementType == ELSE -> node.parent({ it.elementType == IF && it.treeParent.elementType == BLOCK })!!.treePrev.text
node.treeParent.treePrev is PsiWhiteSpace -> node.treeParent.treePrev.text
else -> "\n"
}
Expand Down

0 comments on commit a0512cc

Please sign in to comment.