-
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
Why new OperatorWrapping rule? #163
Comments
This technically comes from the Kotlin style guide, but I disagree with them, that if statement looks gross IMO. There should be a way to go back to the old behavior. |
"When a line is broken at a non-assignment operator the break comes before the symbol." can lead (in case of var v = 1
- 2
// v == 1 not -1 (more on this at android/kotlin-guides#51).
If decision is made (in android/kotlin-guides#51) to wrap before |
Alrighty, sounds fair. |
@shyiko well thing is that for me consistency with the rest of the code base is more important :( |
Can this rule be disabled? |
@kolboch yes, using |
@Tapchicoma , Thanks, actually found that later but thought it's still should be helpful as this discussion is something I found when investigating my issue. Right now I think I will make the same rule but with an exception to && and || operators. Do you think it is worth of pull request or that it is rather project-specific and should stay there to not mess up with guidelines? |
Official styleguide is the target for this project rules, so in your case it should be project-specific custom rule. |
Can someone point the source for that decision?
Currently default for Java with checkstyle and many is to break before those.
http://checkstyle.sourceforge.net/apidocs/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.html
Kotlin guide https://android.github.io/kotlin-guides/style.html#where-to-break says:
"When a line is broken at a non-assignment operator the break comes before the symbol."
So it seems consensus was more to have the break before the operator and as such && || at the start of the new line. It allows way better reading.
If there's no way to return to previous way is there a way to manage that via editorconfig or something?
The text was updated successfully, but these errors were encountered: