From e07624998ad6506f83af068f850378484a579418 Mon Sep 17 00:00:00 2001
From: Matthew Haughton <3flex@users.noreply.github.com>
Date: Fri, 7 Oct 2022 17:11:21 +1100
Subject: [PATCH 1/4] Enforce trailing commas at call site by default

---
 .../ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt
index b0d876ea7b..ede9fcf1f6 100644
--- a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt
+++ b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt
@@ -267,7 +267,7 @@ public class TrailingCommaOnCallSiteRule :
                     PropertyValueParser.BOOLEAN_VALUE_PARSER,
                     BOOLEAN_VALUES_SET,
                 ),
-                defaultValue = false,
+                defaultValue = true,
             )
 
         private val TYPES_ON_CALL_SITE = TokenSet.create(

From abb4c67ca0e9982c01d603b4216f77a3bc0a358a Mon Sep 17 00:00:00 2001
From: paul-dingemans <paul-dingemans@users.noreply.github.com>
Date: Sun, 6 Nov 2022 18:28:11 +0100
Subject: [PATCH 2/4] Change default value for trailing comma on call site for
 default kotlin codestyle only.

---
 CHANGELOG.md                                         |  1 +
 docs/rules/standard.md                               | 12 ++++++++++++
 .../ruleset/standard/TrailingCommaOnCallSiteRule.kt  |  1 +
 3 files changed, 14 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1384a85958..4b9e892f17 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,7 @@ Calling this API with a file path results in the `.editorconfig` files that will
 
 ### Changed
 * Update Kotlin development version to `1.7.20` and Kotlin version to `1.7.20`.
+* The default value for trailing comma's on call site is changed to `true` unless the `android codestyle` is enabled. Note that KtLint from a consistency viewpoint *enforces* the trailing comma on call site while default IntelliJ IDEA formatting only *allows* the trailing comma but leaves it up to the developer's discretion. ([#1670](https://github.com/pinterest/ktlint/pull/1670))
 
 ## [0.47.1] - 2022-09-07
 
diff --git a/docs/rules/standard.md b/docs/rules/standard.md
index 03c2caa0b4..5f6e3ced97 100644
--- a/docs/rules/standard.md
+++ b/docs/rules/standard.md
@@ -170,6 +170,18 @@ Rule id: `string-template`
 
 Consistent removal (default) or adding of trailing comma's on call site.
 
+!!! important
+    KtLint uses the IntelliJ IDEA `.editorconfig` property `ij_kotlin_allow_trailing_comma_on_call_site` to configure the rule. When tis property is enabled, KtLint *enforces* the usage of the trailing comma at call site while IntelliJ IDEA default formatter only *allows* to use the trailing comma but leaves it to the developer's discretion to actually use it (or not). KtLint values *consistent* formatting more than a per-situation decision.
+
+!!! note
+    In KtLint 0.48.x the default value for using the trailing comma on call site has been changed to `true` except when codestyle `android` is used.
+    
+    Although the Kotlin coding conventions](https://kotlinlang.org/docs/reference/coding-conventions.html#names-for-test-methods) leaves it to the developer's discretion to use trailing comma's on the call site, it also states that usage of trailing commas has several benefits:
+    
+     * It makes version-control diffs cleaner – as all the focus is on the changed value.
+     * It makes it easy to add and reorder elements – there is no need to add or delete the comma if you manipulate elements.
+     * It simplifies code generation, for example, for object initializers. The last element can also have a comma.
+
 Rule id: `trailing-comma-on-call-site`
 
 ## Trailing comma on declaration site
diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt
index ede9fcf1f6..4a96e46659 100644
--- a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt
+++ b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt
@@ -268,6 +268,7 @@ public class TrailingCommaOnCallSiteRule :
                     BOOLEAN_VALUES_SET,
                 ),
                 defaultValue = true,
+                defaultAndroidValue = false
             )
 
         private val TYPES_ON_CALL_SITE = TokenSet.create(

From 461d4a536e59ad8eefee6629a22ae6b281ff8d68 Mon Sep 17 00:00:00 2001
From: paul-dingemans <paul-dingemans@users.noreply.github.com>
Date: Sun, 6 Nov 2022 18:33:42 +0100
Subject: [PATCH 3/4] Update docs

---
 docs/rules/standard.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/rules/standard.md b/docs/rules/standard.md
index 5f6e3ced97..9319d739db 100644
--- a/docs/rules/standard.md
+++ b/docs/rules/standard.md
@@ -171,7 +171,7 @@ Rule id: `string-template`
 Consistent removal (default) or adding of trailing comma's on call site.
 
 !!! important
-    KtLint uses the IntelliJ IDEA `.editorconfig` property `ij_kotlin_allow_trailing_comma_on_call_site` to configure the rule. When tis property is enabled, KtLint *enforces* the usage of the trailing comma at call site while IntelliJ IDEA default formatter only *allows* to use the trailing comma but leaves it to the developer's discretion to actually use it (or not). KtLint values *consistent* formatting more than a per-situation decision.
+    KtLint uses the IntelliJ IDEA `.editorconfig` property `ij_kotlin_allow_trailing_comma_on_call_site` to configure the rule. When this property is enabled, KtLint *enforces* the usage of the trailing comma at call site while IntelliJ IDEA default formatter only *allows* to use the trailing comma but leaves it to the developer's discretion to actually use it (or not). KtLint values *consistent* formatting more than a per-situation decision.
 
 !!! note
     In KtLint 0.48.x the default value for using the trailing comma on call site has been changed to `true` except when codestyle `android` is used.

From efe275d1971a7c06685f2fe28719ec4d4aeb64f3 Mon Sep 17 00:00:00 2001
From: paul-dingemans <paul-dingemans@users.noreply.github.com>
Date: Sun, 6 Nov 2022 20:31:50 +0100
Subject: [PATCH 4/4] Fix lint violation

---
 .../ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt
index 4a96e46659..14d30e615c 100644
--- a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt
+++ b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/TrailingCommaOnCallSiteRule.kt
@@ -268,7 +268,7 @@ public class TrailingCommaOnCallSiteRule :
                     BOOLEAN_VALUES_SET,
                 ),
                 defaultValue = true,
-                defaultAndroidValue = false
+                defaultAndroidValue = false,
             )
 
         private val TYPES_ON_CALL_SITE = TokenSet.create(