-
Notifications
You must be signed in to change notification settings - Fork 888
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
split before binary operators #266
Comments
Things get a bit difficult when multiple knobs address the same thing. For example, if So I think that there should be an "all or nothing" knob. Either we have the current two knobs or we have one knob that effects both bitwise and logical operators. |
@gwelymernans You could have yapf exit with an error if two conflicting options are set, and explain why. I would to see an option like this. I have actually been formatting code this way for a long time, for the reasons Knuth mentions. I am glad PEP8 now agrees with me. |
Whether or not |
@gwelymernans Any chance of implementing split before arithmetic operators? If not, I'd be happy to take a crack at it. Which files contain the necessary logic? |
Hi @alok, I've been swamped at work, so I haven't been able to focus on YAPF in a while. If you'd like to take a crack at it, I would appreciate it. A lot of the formatting decisions are made in |
@gwelymernans I think I'd just model it based off of the split rule for bitwise operators, though I wonder if the fact that both |
PEP8 recently switched to recommending splitting lines before binary ops rather than after (https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator). There are some specialized knobs available (SPLIT_BEFORE_BITWISE_OPERATOR, SPLIT_BEFORE_LOGICAL_OPERATOR), but a general SPLIT_BEFORE_BINARY_OPERATOR would be simpler to work with.
The text was updated successfully, but these errors were encountered: