-
Notifications
You must be signed in to change notification settings - Fork 506
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
Introduce codestyle set #548
Comments
With #1488 the I see no reason for further implementation of "flexible" code style rules. As no one else has attempted to introduce this in the last 3 years, the issue is closed. |
@paul-dingemans as it was described in the ticket from which this ticket is originated, .editorconfig is not a scalable option, this is why the flag is requested. You can read more details here: #533 The problem with ktlint is that it is android-centric and doesn't use official code style. In our company we use kotlin for backend for hundreds of services, not for android. With the proposed option of having it in editorconfig, the file that does nothing else but just sets the official kotlin code style, has to be copied through hundreds of projects. With the flag, it is just a matter of adding it to the one place, a parent-pom, to have consistency of configuration across all the projects. |
In last couple of years, the focus is shifting more and more towards
I don't believe this is true. The default code style if the official Kotlin codestyle. If you want to use In case your company does not use |
Proposal
Ktlint should introduce codestyle-set concept. Codestyle-set will contain set of rules, that would be used by ktlint on linting/formatting the code.
Such approach:
Implementation details
Each codestyle-set should have a unique name and contain list of rule ids. Codestyle-set could extend another codestyle-set by adding (removing (?)) rules to the parent one.
Built-in
Ktlint should provide built-in codestyle-sets:
.Editorconfig
User should be able to define and use custom codestyle-set, using
.editorconfig
file:where
codestyle-set-define
has following format:.Editorconfig
can contain severalcodestyle-set
entries, but only last onecodestyle-set
entry will be used by Ktlint.Nested
.editorconfig
files could overridecodestyle-set
entry used in parent.editorconfig
.Command line
Usage of codestyle-set in command line looks similar to how it is done in
.editorconfig
file:Deprecations
--android
CLI flag should be replace by "android" codestyle-setThe text was updated successfully, but these errors were encountered: