From 3fb34596ae26ceeaf21274e4fd587af938a7eb69 Mon Sep 17 00:00:00 2001 From: Dmitry Gridin Date: Thu, 30 Jan 2020 20:41:57 +0700 Subject: [PATCH] Code style: disable trailing comma by default #KT-34744 --- .../idea/core/formatter/KotlinCodeStyleSettings.java | 2 +- .../kotlin/idea/formatter/KotlinStyleGuideCodeStyle.kt | 2 +- tests/mute-common.csv | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java b/idea/formatter/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java index b6ee014a3e4..e7bbbb75452 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java @@ -53,7 +53,7 @@ public class KotlinCodeStyleSettings extends CustomCodeStyleSettings { public int WRAP_EXPRESSION_BODY_FUNCTIONS = 0; public int WRAP_ELVIS_EXPRESSIONS = 1; public boolean IF_RPAREN_ON_NEW_LINE = false; - public boolean ALLOW_TRAILING_COMMA = true; + public boolean ALLOW_TRAILING_COMMA = false; @ReflectionUtil.SkipInEquals public String CODE_STYLE_DEFAULTS = null; diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinStyleGuideCodeStyle.kt b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinStyleGuideCodeStyle.kt index 9f189930ee8..33d734a2015 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinStyleGuideCodeStyle.kt +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinStyleGuideCodeStyle.kt @@ -58,7 +58,7 @@ class KotlinStyleGuideCodeStyle : KotlinPredefinedCodeStyle("Kotlin style guide" CONTINUATION_INDENT_IN_ELVIS = false WRAP_EXPRESSION_BODY_FUNCTIONS = CodeStyleSettings.WRAP_AS_NEEDED IF_RPAREN_ON_NEW_LINE = true - ALLOW_TRAILING_COMMA = true + ALLOW_TRAILING_COMMA = false } } diff --git a/tests/mute-common.csv b/tests/mute-common.csv index 4c782d2c776..34efd864ea0 100644 --- a/tests/mute-common.csv +++ b/tests/mute-common.csv @@ -54,3 +54,11 @@ org.jetbrains.kotlin.psi.injection.StringInterpolationInjectionTest.testInterpol org.jetbrains.kotlin.shortenRefs.ShortenRefsTestGenerated.testExtensionForObject2, Always red org.jetbrains.kotlin.util.KotlinVersionsTest.testVersionsAreConsistent, KT-35567 org.jetbrains.kotlinx.serialization.SerializationIrBytecodeListingTestGenerated.testBasic, Broken between 20 nov and 10 dec +org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.TrailingComma.testAddComma +org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.TrailingComma.testAddComma2 +org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.TrailingComma.testAddComma5 +org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.TrailingComma.testAddComma6 +org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.TrailingComma.testChangeCommaPosition +org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.TrailingComma.testChangeCommaPosition2 +org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.TrailingComma.testMissingLineBreak +org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.TrailingComma.testMissingLineBreak2