diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/BlockStructureBraces.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/BlockStructureBraces.kt index a8f7e16ed5..c7bdf700c6 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/BlockStructureBraces.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/BlockStructureBraces.kt @@ -235,7 +235,7 @@ class BlockStructureBraces(configRules: List) : DiktatRule( } var space = node.findChildByType(RBRACE)!!.treePrev node.findParentNodeWithSpecificType(ElementType.LAMBDA_ARGUMENT)?.let { - if (space.text == "") { + if (space.text.isEmpty()) { space = space.treePrev } } diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/BlankLinesRule.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/BlankLinesRule.kt index 0e59e97c63..5141ee3749 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/BlankLinesRule.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/BlankLinesRule.kt @@ -47,6 +47,7 @@ class BlankLinesRule(configRules: List) : DiktatRule( it.elementType == CLASS_BODY || it.elementType == FUNCTION_LITERAL }) { node.findParentNodeWithSpecificType(LAMBDA_ARGUMENT)?.let { + // Lambda body is always has a BLOCK -> run { } - (LBRACE, WHITE_SPACE, BLOCK "", RBRACE) if ((node.treeNext?.treeNext?.elementType == RBRACE) && (node.treePrev.elementType == LBRACE)) { val freeText = "do not put newlines in empty lambda" TOO_MANY_BLANK_LINES.warnAndFix(configRules, emitWarn, isFixMode, freeText, node.startOffset, node) {