Skip to content
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

Enum wrapping rule #1903

Closed
paul-dingemans opened this issue Mar 30, 2023 · 0 comments · Fixed by #1907
Closed

Enum wrapping rule #1903

paul-dingemans opened this issue Mar 30, 2023 · 0 comments · Fixed by #1907
Milestone

Comments

@paul-dingemans
Copy link
Collaborator

The Kotlin coding conventions are not very specific about formatting enumerations. Android Kotlin Style Guide is more specific and can be used as a common base for all code styles. Though the exception below does not really make sense to me:

When the constants in an enum are placed on separate lines, a blank line is not required between them except in the case where they define a body.

Additional rules should be:

  • All enum entries including the braces should be on a single line enum class Answer { YES, NO, MAYBE }, or in case of a multiline declaration, each enum entry is listed on a separate line.
  • In case the trailing comma's are enabled and the enumeration contains another declaration then semicolon is placed on a separate line below the enumeration entries.
  • In case the enumeration contains another declaration then the semicolon after the enumeration entries is followed by a blank line followed by the other declaration(s).
paul-dingemans added a commit that referenced this issue Apr 1, 2023
…m should either be a single line, or each enum entry should be defined on a separate line

Closes #1903

Fix bug in RuleProviderSorter. A rule marked with RunAsLateAsPossible should never be run before a rule not having any Rule.VisitorModifier.
@paul-dingemans paul-dingemans added this to the 0.49.0 milestone Apr 1, 2023
paul-dingemans added a commit that referenced this issue Apr 2, 2023
* Add new experimental rule `enum-wrapping` for all code styles. An enum should either be a single line, or each enum entry should be defined on a separate line

Closes #1903

Fix bug in RuleProviderSorter. A rule marked with RunAsLateAsPossible should never be run before a rule not having any Rule.VisitorModifier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant