-
Notifications
You must be signed in to change notification settings - Fork 508
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
Class members ordering rule #309
Comments
Let's hold off on this until #208 is implemented. I imagine many developers have their own opinions about class ordering that they wouldn't want touched by ktlint. |
Are there any updates regarding this issue? |
@duncte123 It's on my todo list to implement in the near future, but contributions are welcome of course |
I've looked at adding the rule but I cannot figure out how to make it work unfortunately |
@duncte123 what exactly you can't figure? You could also drop a message on kotlinlang slack either in the #ktlint channel or directly to me |
It's most likely that creating this specific rule goes above my skillset when it comes to kotlin |
This topic is probably way too large / complex to be solved. Especially autocorrecting problems is nearly impossible. For example regarding the ordering of methods, the coding guidelines specify following:
Perhaps the problem should be sliced into smaller problems that are more likely to be solved. A few examples of such smaller problems would be:
All in all I do understand the request for this change. But I think an auto correct rule can never be achieved as there are too many situations in which the autocorrect would make things worse. So my advice would be to stick to adding a (report only) rule to identify classes which might violate the ordering advised in the Kotlin style guide. It should be easy to disable the rule per class/file in case after manual inspection it is decided that the rule is not applicable for the class/file. |
This issue should be considered stale. It has been created nearly 4 years ago. More than 1.5 years have been gone, since I lastly wrote about the complexity of this functionality. As no new ideas have popped up, it is time to close the issue and move on. |
As per kotlin styleguide they recommend to sort the contents of a class with the given order, I would also like to add it to the standard ruleset + formatter. What's your thoughts on this one?
The text was updated successfully, but these errors were encountered: