Kotlin - Enable trailing comma (#3959)

Trailing commas on Kotlin sources [has many
advantages](https://pinterest.github.io/ktlint/0.49.0/rules/standard/#trailing-comma-on-call-site):
- 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.

This PR doesn't go as far as require it, but tweaks KtLint to at least
allow it.

The two `.kt` files prove that the KtLint rules have been properly
disabled.
This commit is contained in:
Levi Bard 2023-09-08 09:17:50 +02:00 committed by GitHub
commit 40d771d60f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View file

@ -20,5 +20,5 @@ enum class Screen {
Note,
Done,
Back,
Finish
Finish,
}

View file

@ -163,8 +163,8 @@ class ScheduledStatusActivity :
visibility = item.params.visibility,
scheduledAt = item.scheduledAt,
sensitive = item.params.sensitive,
kind = ComposeActivity.ComposeKind.EDIT_SCHEDULED
)
kind = ComposeActivity.ComposeKind.EDIT_SCHEDULED,
),
)
startActivity(intent)
}