diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/IndentationRule.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/IndentationRule.kt index e016143a83..bad5240b9d 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/IndentationRule.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/IndentationRule.kt @@ -45,7 +45,6 @@ import com.pinterest.ktlint.core.ast.ElementType.STRING_TEMPLATE import com.pinterest.ktlint.core.ast.ElementType.THEN import com.pinterest.ktlint.core.ast.ElementType.WHITE_SPACE import com.pinterest.ktlint.core.ast.visit -import org.cqfn.diktat.ruleset.utils.hasParent import org.jetbrains.kotlin.com.intellij.lang.ASTNode import org.jetbrains.kotlin.com.intellij.psi.PsiWhiteSpace import org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.LeafPsiElement diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/indentation/Checkers.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/indentation/Checkers.kt index 0e3f2b550d..8ecd8494a7 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/indentation/Checkers.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/indentation/Checkers.kt @@ -6,6 +6,7 @@ package org.cqfn.diktat.ruleset.utils.indentation import org.cqfn.diktat.ruleset.rules.chapter3.files.IndentationError import org.cqfn.diktat.ruleset.rules.chapter3.files.lastIndent +import org.cqfn.diktat.ruleset.utils.hasParent import com.pinterest.ktlint.core.ast.ElementType.ARROW import com.pinterest.ktlint.core.ast.ElementType.AS_KEYWORD @@ -39,7 +40,6 @@ import com.pinterest.ktlint.core.ast.ElementType.VALUE_PARAMETER_LIST import com.pinterest.ktlint.core.ast.ElementType.WHITE_SPACE import com.pinterest.ktlint.core.ast.nextCodeSibling import com.pinterest.ktlint.core.ast.prevSibling -import org.cqfn.diktat.ruleset.utils.hasParent import org.jetbrains.kotlin.com.intellij.lang.ASTNode import org.jetbrains.kotlin.com.intellij.psi.PsiElement import org.jetbrains.kotlin.com.intellij.psi.PsiWhiteSpace @@ -205,8 +205,8 @@ internal class DotCallChecker(config: IndentationConfig) : CustomIndentationChec whiteSpace.nextSibling.node .takeIf { nextNode -> (nextNode.isDotBeforeCallOrReference() || - nextNode.elementType == OPERATION_REFERENCE && nextNode.firstChildNode.elementType.let { - it == ELVIS || it == IS_EXPRESSION || it == AS_KEYWORD || it == AS_SAFE + nextNode.elementType == OPERATION_REFERENCE && nextNode.firstChildNode.elementType.let { type -> + type == ELVIS || type == IS_EXPRESSION || type == AS_KEYWORD || type == AS_SAFE } || nextNode.isCommentBeforeDot()) && whiteSpace.parents.none { it.node.elementType == LONG_STRING_TEMPLATE_ENTRY } } ?.let { diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt index 836be9aafa..d73159b3ca 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt @@ -610,7 +610,7 @@ class IndentationRuleWarnTest : LintTestBase(::IndentationRule) { @Tag(WarningNames.WRONG_INDENTATION) fun `should trigger on string templates starting with new line`() { lintMethod( - """ + """ |fun foo(some: String) { | fun bar() { | val a = "${'$'}{ @@ -624,10 +624,10 @@ class IndentationRuleWarnTest : LintTestBase(::IndentationRule) { |} | """.trimMargin(), - LintError(4, 1, ruleId, warnText(12, 8), true), - LintError(5, 1, ruleId, warnText(16, 12), true), - LintError(6, 1, ruleId, warnText(16, 12), true), - rulesConfigList = rulesConfigList + LintError(4, 1, ruleId, warnText(12, 8), true), + LintError(5, 1, ruleId, warnText(16, 12), true), + LintError(6, 1, ruleId, warnText(16, 12), true), + rulesConfigList = rulesConfigList ) }