From b6f9ad50366315604b1f24742bdc900867d96566 Mon Sep 17 00:00:00 2001 From: Stanley Shyiko Date: Sun, 3 Feb 2019 22:23:36 -0800 Subject: [PATCH] Fixed #327 - 'Missing newline before ")"' --- .../shyiko/ktlint/ruleset/standard/ParameterListWrappingRule.kt | 2 +- .../ktlint/ruleset/standard/ParameterListWrappingRuleTest.kt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/ParameterListWrappingRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/ParameterListWrappingRule.kt index e2bc207b85..00aea29b42 100644 --- a/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/ParameterListWrappingRule.kt +++ b/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/ParameterListWrappingRule.kt @@ -88,7 +88,7 @@ class ParameterListWrappingRule : Rule("parameter-list-wrapping") { paramInnerIndentAdjustment = adjustedIndent.length - prevLeaf.textLength (prevLeaf as LeafPsiElement).rawReplaceWithText(adjustedIndent) } - } else { + } else if (prevLeaf?.prevLeafIgnoringWhitespaceAndComments()?.node?.elementType != KtTokens.LPAR) { emit(child.startOffset, errorMessage(child), true) if (autoCorrect) { paramInnerIndentAdjustment = intendedIndent.length - child.psi.column diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/ParameterListWrappingRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/ParameterListWrappingRuleTest.kt index 24c048e969..c7b98613ec 100644 --- a/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/ParameterListWrappingRuleTest.kt +++ b/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/ParameterListWrappingRuleTest.kt @@ -137,6 +137,8 @@ class ParameterListWrappingRuleTest { b: Any, c: Any) { } + fun f() {} + fun f(/**/) {} """.trimIndent() )).isEqualTo( listOf(