From 9d3024cc0b24f890b9d43d3903fc13d98b7ea3a7 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Mon, 16 May 2022 14:08:44 +0100 Subject: [PATCH 01/10] Allow one whitespace line in chained expressions --- .../standard/NoConsecutiveBlankLinesRule.kt | 8 ++-- .../NoConsecutiveBlankLinesRuleTest.kt | 41 +++++++++++++------ 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoConsecutiveBlankLinesRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoConsecutiveBlankLinesRule.kt index f4fb1093a5..174a023dd9 100644 --- a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoConsecutiveBlankLinesRule.kt +++ b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoConsecutiveBlankLinesRule.kt @@ -2,7 +2,6 @@ package com.pinterest.ktlint.ruleset.standard import com.pinterest.ktlint.core.Rule import com.pinterest.ktlint.core.ast.ElementType.CLASS -import com.pinterest.ktlint.core.ast.ElementType.DOT_QUALIFIED_EXPRESSION import com.pinterest.ktlint.core.ast.ElementType.IDENTIFIER import com.pinterest.ktlint.core.ast.ElementType.PRIMARY_CONSTRUCTOR import com.pinterest.ktlint.core.ast.nextLeaf @@ -25,20 +24,21 @@ public class NoConsecutiveBlankLinesRule : Rule("no-consecutive-blank-lines") { if (lfcount < 2) { return } + val eof = node.nextLeaf() == null val prevNode = node.treePrev val betweenClassAndPrimaryConstructor = prevNode.elementType == IDENTIFIER && prevNode.treeParent.elementType == CLASS && node.treeNext.elementType == PRIMARY_CONSTRUCTOR - val inDotQualifiedExpression = node.treeParent.elementType == DOT_QUALIFIED_EXPRESSION && lfcount > 1 - if (lfcount > 2 || eof || betweenClassAndPrimaryConstructor || inDotQualifiedExpression) { + + if (lfcount > 2 || eof || betweenClassAndPrimaryConstructor) { val split = text.split("\n") emit(node.startOffset + split[0].length + split[1].length + 2, "Needless blank line(s)", true) if (autoCorrect) { val newText = buildString { append(split.first()) append("\n") - if (!eof && !betweenClassAndPrimaryConstructor && !inDotQualifiedExpression) append("\n") + if (!eof && !betweenClassAndPrimaryConstructor) append("\n") append(split.last()) } (node as LeafPsiElement).rawReplaceWithText(newText) diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoConsecutiveBlankLinesRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoConsecutiveBlankLinesRuleTest.kt index eb4e425a8c..8979fa173e 100644 --- a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoConsecutiveBlankLinesRuleTest.kt +++ b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoConsecutiveBlankLinesRuleTest.kt @@ -3,7 +3,6 @@ package com.pinterest.ktlint.ruleset.standard import com.pinterest.ktlint.test.KtLintAssertThat.Companion.assertThat import com.pinterest.ktlint.test.LintViolation import com.pinterest.ktlint.test.MULTILINE_STRING_QUOTE -import com.pinterest.ktlint.test.format import com.pinterest.ktlint.test.lint import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Nested @@ -176,25 +175,41 @@ class NoConsecutiveBlankLinesRuleTest { } @Test - fun `should remove line in dot qualified expression`() { - assertThat( - NoConsecutiveBlankLinesRule().format( - """ - fun foo(inputText: String) { - inputText + fun `Given single blank line in dot qualified expression should not return lint errors`() { + val code = + """ + fun foo(inputText: String) { + inputText + .toLowerCase() + } + """.trimIndent() - .toLowerCase() - } - """.trimIndent() - ) - ).isEqualTo( + noConsecutiveBlankLinesRuleAssertThat(code).hasNoLintViolations() + } + + @Test + fun `Given multiple blank line in dot qualified expression should return lint error`() { + val code = """ fun foo(inputText: String) { inputText + + .toLowerCase() } """.trimIndent() - ) + + noConsecutiveBlankLinesRuleAssertThat(code) + .hasLintViolations(LintViolation(4, 1, "Needless blank line(s)")) + .isFormattedAs( + """ + fun foo(inputText: String) { + inputText + + .toLowerCase() + } + """.trimIndent() + ) } } From cc212856220ceb31ab0d1c20267d75314cc93f7c Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Mon, 16 May 2022 14:46:56 +0100 Subject: [PATCH 02/10] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bfcffe5d0..2f4dc96757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ An AssertJ style API for testing KtLint rules ([#1444](https://github.com/pinter - Add experimental rule for consistent spacing before the start of the function body (`function-start-of-body-spacing`) ([#1341](https://github.com/pinterest/ktlint/issues/1341)) ### Fixed +- Allow a single whitespace line in chained expressions ([#1469](https://github.com/pinterest/ktlint/pull/1469)) - Fix check of spacing in the receiver type of an anonymous function ([#1440](https://github.com/pinterest/ktlint/issues/1440)) - Allow comment on same line as super class in class declaration `wrapping` ([#1457](https://github.com/pinterest/ktlint/pull/1457)) From 4cd2566bfbea508286c0232e2894707c232bdb92 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Mon, 23 May 2022 12:44:56 +0100 Subject: [PATCH 03/10] Add new empty rule to standard set --- .../NoBlankLinesInChainedMethodCallsRule.kt | 13 +++++++++++++ .../ruleset/standard/StandardRuleSetProvider.kt | 1 + 2 files changed, 14 insertions(+) create mode 100644 ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt new file mode 100644 index 0000000000..dcdb104886 --- /dev/null +++ b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt @@ -0,0 +1,13 @@ +package com.pinterest.ktlint.ruleset.standard + +import com.pinterest.ktlint.core.Rule +import org.jetbrains.kotlin.com.intellij.lang.ASTNode + +public class NoBlankLinesInChainedMethodCallsRule : Rule("no-blank-lines-in-chained-method-calls") { + override fun visit( + node: ASTNode, + autoCorrect: Boolean, + emit: (offset: Int, errorMessage: String, canBeAutoCorrected: Boolean) -> Unit + ) { + } +} diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/StandardRuleSetProvider.kt b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/StandardRuleSetProvider.kt index 1273bdfae3..252f8bbfa0 100644 --- a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/StandardRuleSetProvider.kt +++ b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/StandardRuleSetProvider.kt @@ -18,6 +18,7 @@ public class StandardRuleSetProvider : RuleSetProvider { ModifierOrderRule(), NoBlankLineBeforeRbraceRule(), NoConsecutiveBlankLinesRule(), + NoBlankLinesInChainedMethodCallsRule(), NoEmptyClassBodyRule(), NoLineBreakAfterElseRule(), NoLineBreakBeforeAssignmentRule(), From 4828472a8404201a6430e89416ec5f762a513aee Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Mon, 23 May 2022 13:20:44 +0100 Subject: [PATCH 04/10] Don't allow blank lines in chained method calls --- .../NoBlankLinesInChainedMethodCallsRule.kt | 6 +++ ...oBlankLinesInChainedMethodCallsRuleTest.kt | 39 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt index dcdb104886..ac27fde317 100644 --- a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt +++ b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt @@ -1,7 +1,9 @@ package com.pinterest.ktlint.ruleset.standard import com.pinterest.ktlint.core.Rule +import com.pinterest.ktlint.core.ast.ElementType.DOT_QUALIFIED_EXPRESSION import org.jetbrains.kotlin.com.intellij.lang.ASTNode +import org.jetbrains.kotlin.com.intellij.psi.PsiWhiteSpace public class NoBlankLinesInChainedMethodCallsRule : Rule("no-blank-lines-in-chained-method-calls") { override fun visit( @@ -9,5 +11,9 @@ public class NoBlankLinesInChainedMethodCallsRule : Rule("no-blank-lines-in-chai autoCorrect: Boolean, emit: (offset: Int, errorMessage: String, canBeAutoCorrected: Boolean) -> Unit ) { + val isBlankLine = node is PsiWhiteSpace && node.getText().contains("\n\n") + if (isBlankLine && node.treeParent.elementType == DOT_QUALIFIED_EXPRESSION) { + emit(node.startOffset + 1, "Needless blank line(s)", true) + } } } diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt new file mode 100644 index 0000000000..f1528bbfbc --- /dev/null +++ b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt @@ -0,0 +1,39 @@ +package com.pinterest.ktlint.ruleset.standard + +import com.pinterest.ktlint.test.KtLintAssertThat.Companion.assertThat +import com.pinterest.ktlint.test.LintViolation +import org.junit.jupiter.api.Test + +class NoBlankLinesInChainedMethodCallsRuleTest { + + private val noBlankLinesInChainedMethodCallsRuleAssertThat = NoBlankLinesInChainedMethodCallsRule().assertThat() + + @Test + fun `single blank line in dot qualified expression returns lint error`() { + val code = + """ + fun foo(inputText: String) { + inputText + + .toLowerCase() + } + """.trimIndent() + + noBlankLinesInChainedMethodCallsRuleAssertThat(code) + .hasLintViolations(LintViolation(3, 1, "Needless blank line(s)")) + } + + @Test + fun `single blank line between statements does not return lint error`() { + val code = + """ + fun foo(inputText: String) { + bar() + + bar() + } + """.trimIndent() + + noBlankLinesInChainedMethodCallsRuleAssertThat(code).hasNoLintViolations() + } +} From 7a00b366cdbf2a8531c2ba7a221d680019a3f932 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Mon, 23 May 2022 14:20:27 +0100 Subject: [PATCH 05/10] Remove blank line from chained methods --- .../standard/NoBlankLinesInChainedMethodCallsRule.kt | 2 ++ .../standard/NoBlankLinesInChainedMethodCallsRuleTest.kt | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt index ac27fde317..65092a07c1 100644 --- a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt +++ b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt @@ -4,6 +4,7 @@ import com.pinterest.ktlint.core.Rule import com.pinterest.ktlint.core.ast.ElementType.DOT_QUALIFIED_EXPRESSION 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 public class NoBlankLinesInChainedMethodCallsRule : Rule("no-blank-lines-in-chained-method-calls") { override fun visit( @@ -14,6 +15,7 @@ public class NoBlankLinesInChainedMethodCallsRule : Rule("no-blank-lines-in-chai val isBlankLine = node is PsiWhiteSpace && node.getText().contains("\n\n") if (isBlankLine && node.treeParent.elementType == DOT_QUALIFIED_EXPRESSION) { emit(node.startOffset + 1, "Needless blank line(s)", true) + (node as LeafPsiElement).rawReplaceWithText("\n" + node.getText().split("\n\n")[1]) } } } diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt index f1528bbfbc..78cc2c3fd4 100644 --- a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt +++ b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt @@ -21,6 +21,14 @@ class NoBlankLinesInChainedMethodCallsRuleTest { noBlankLinesInChainedMethodCallsRuleAssertThat(code) .hasLintViolations(LintViolation(3, 1, "Needless blank line(s)")) + .isFormattedAs( + """ + fun foo(inputText: String) { + inputText + .toLowerCase() + } + """.trimIndent() + ) } @Test From afd68463f688113b4ed4faf95bcbad3a88766cfe Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Mon, 23 May 2022 14:22:56 +0100 Subject: [PATCH 06/10] Only format when autoCorrect is true --- .../ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt index 65092a07c1..f6b08ac0ce 100644 --- a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt +++ b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRule.kt @@ -15,7 +15,10 @@ public class NoBlankLinesInChainedMethodCallsRule : Rule("no-blank-lines-in-chai val isBlankLine = node is PsiWhiteSpace && node.getText().contains("\n\n") if (isBlankLine && node.treeParent.elementType == DOT_QUALIFIED_EXPRESSION) { emit(node.startOffset + 1, "Needless blank line(s)", true) - (node as LeafPsiElement).rawReplaceWithText("\n" + node.getText().split("\n\n")[1]) + + if (autoCorrect) { + (node as LeafPsiElement).rawReplaceWithText("\n" + node.getText().split("\n\n")[1]) + } } } } From ae7202ff0314ae16bf9ef3b3e0a8f6a6dc8d3a25 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Mon, 23 May 2022 14:24:55 +0100 Subject: [PATCH 07/10] Add new rule to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8c430674bb..b61bd56814 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ It's also [easy to create your own](#creating-a-reporter). - `modifier-order`: Consistent order of modifiers - `no-blank-line-before-rbrace`: No blank lines before `}` - `no-consecutive-blank-lines`: No consecutive blank lines +- `no-blank-lines-in-chained-method-calls`: No blank lines in chained method expressions - `no-empty-class-body`: No empty (`{}`) class bodies - `no-line-break-after-else`: Disallows line breaks after the else keyword if that could lead to confusion, for example: ```kotlin From 2eb7c87d79df30c0b9369c3206b769472055a9a2 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Mon, 23 May 2022 14:26:38 +0100 Subject: [PATCH 08/10] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f4dc96757..26bbb36651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ An AssertJ style API for testing KtLint rules ([#1444](https://github.com/pinter - Add experimental rule for consistent spacing before the start of the function body (`function-start-of-body-spacing`) ([#1341](https://github.com/pinterest/ktlint/issues/1341)) ### Fixed -- Allow a single whitespace line in chained expressions ([#1469](https://github.com/pinterest/ktlint/pull/1469)) +- Separate out disallowing blank lines in chained method calls to a new rule ([#1469](https://github.com/pinterest/ktlint/pull/1469)) - Fix check of spacing in the receiver type of an anonymous function ([#1440](https://github.com/pinterest/ktlint/issues/1440)) - Allow comment on same line as super class in class declaration `wrapping` ([#1457](https://github.com/pinterest/ktlint/pull/1457)) From aefb60c456fb8adc64d2950f83fad25de1fb865f Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 24 May 2022 20:31:28 +0200 Subject: [PATCH 09/10] Refactor test --- ...oBlankLinesInChainedMethodCallsRuleTest.kt | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt index 78cc2c3fd4..4a03cfe5cd 100644 --- a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt +++ b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/NoBlankLinesInChainedMethodCallsRuleTest.kt @@ -1,11 +1,9 @@ package com.pinterest.ktlint.ruleset.standard import com.pinterest.ktlint.test.KtLintAssertThat.Companion.assertThat -import com.pinterest.ktlint.test.LintViolation import org.junit.jupiter.api.Test class NoBlankLinesInChainedMethodCallsRuleTest { - private val noBlankLinesInChainedMethodCallsRuleAssertThat = NoBlankLinesInChainedMethodCallsRule().assertThat() @Test @@ -18,17 +16,16 @@ class NoBlankLinesInChainedMethodCallsRuleTest { .toLowerCase() } """.trimIndent() - + val formattedCode = + """ + fun foo(inputText: String) { + inputText + .toLowerCase() + } + """.trimIndent() noBlankLinesInChainedMethodCallsRuleAssertThat(code) - .hasLintViolations(LintViolation(3, 1, "Needless blank line(s)")) - .isFormattedAs( - """ - fun foo(inputText: String) { - inputText - .toLowerCase() - } - """.trimIndent() - ) + .hasLintViolation(3, 1, "Needless blank line(s)") + .isFormattedAs(formattedCode) } @Test @@ -41,7 +38,6 @@ class NoBlankLinesInChainedMethodCallsRuleTest { bar() } """.trimIndent() - noBlankLinesInChainedMethodCallsRuleAssertThat(code).hasNoLintViolations() } } From 5fb54285f01fee762124be2042abe776c9d90073 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 24 May 2022 20:36:20 +0200 Subject: [PATCH 10/10] Fix changelog and readme --- CHANGELOG.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26bbb36651..a5212a7c20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ An AssertJ style API for testing KtLint rules ([#1444](https://github.com/pinter - Add experimental rule for consistent spacing before the start of the function body (`function-start-of-body-spacing`) ([#1341](https://github.com/pinterest/ktlint/issues/1341)) ### Fixed -- Separate out disallowing blank lines in chained method calls to a new rule ([#1469](https://github.com/pinterest/ktlint/pull/1469)) +- Move disallowing blank lines in chained method calls from `no-consecutive-blank-lines` to new rule (`no-blank-lines-in-chained-method-calls`) ([#1248](https://github.com/pinterest/ktlint/issues/1248)) - Fix check of spacing in the receiver type of an anonymous function ([#1440](https://github.com/pinterest/ktlint/issues/1440)) - Allow comment on same line as super class in class declaration `wrapping` ([#1457](https://github.com/pinterest/ktlint/pull/1457)) diff --git a/README.md b/README.md index b61bd56814..afa9ef7ef8 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,8 @@ It's also [easy to create your own](#creating-a-reporter). - `max-line-length`: Ensures that lines do not exceed the given length of `.editorconfig` property `max_line_length` (see [EditorConfig](#editorconfig) section for more). This rule does not apply in a number of situations. For example, in the case a line exceeds the maximum line length due to and comment that disables ktlint rules than that comment is being ignored when validating the length of the line. The `.editorconfig` property `ktlint_ignore_back_ticked_identifier` can be set to ignore identifiers which are enclosed in backticks, which for example is very useful when you want to allow longer names for unit tests. - `modifier-order`: Consistent order of modifiers - `no-blank-line-before-rbrace`: No blank lines before `}` -- `no-consecutive-blank-lines`: No consecutive blank lines - `no-blank-lines-in-chained-method-calls`: No blank lines in chained method expressions +- `no-consecutive-blank-lines`: No consecutive blank lines - `no-empty-class-body`: No empty (`{}`) class bodies - `no-line-break-after-else`: Disallows line breaks after the else keyword if that could lead to confusion, for example: ```kotlin