-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce trailing commas at declaration site by default #1669
Conversation
Tnx for your patch. For this setting I tend to agree with you that |
I don't follow the logic for Android - I thought the Android style guide was essentially considered an extension of the Kotlin Coding Conventions, with some extra rules, and a few things that override the standard conventions, though perhaps that's not how ktlint deals with it. In any case, I don't think it's correct to set the Android value to If you don't agree I might make this a draft and open a new issue to discuss further and perhaps get external input. |
As far as I know, the Kotlin Coding Convention and Androids Kotlin Style Guide are indenpendent of each other, but luckily they do overlap on a lot of things. For some editorconfig settings a different default value is used however.
KtLint indeed has a more strict interpretation of the the flags than IntelliJ / Android. KtLint considers a consistent usage of the trailing more important than IntelliJ / Android. As the rules are already released with default value
I leave this up to you. However, I do not expect much input of the community when you raise this as a separate issue or mention it in the Slack channel. I would love to have more debate with the community about such changes but I have not found a way to get sufficient and timely feedback of the community. |
Android Kotlin code is still Kotlin code, so wouldn't the Kotlin Coding Conventions apply? As long as the Android style guide doesn't have a more specific rule or override the Kotlin Coding Conventions, where you'd use the more specific guidance. If we have I'll still proceed with the PR even if we won't make them consistent, but hopefully this is convincing enough that we can have the same default for both Android and JVM... |
From the Android Kotlint Style Guide:
To me, the word complete suggests that it is independent of any other coding standard.
This is a valid concern. But the same is already happening for the max line length as well. For Android the default value is set to |
Following the arguments I would vote to disable the rule for android by default. If the code convention says nothing it doesn't imply that they should be forbidden. But I would rather prefer to follow the Kotlin convention when the android convention mention nothing about it. |
Description
Kotlin Coding Conventions says:
But ktlint's default config for this rule enforces no comma which directly conflicts with the coding conventions which encourages trailing commas.
Checklist
CHANGELOG.md
is updatedIn case of adding a new rule: