
I've also used uncrustify for c/c++. Of course this plays hell with revision control. On Sun, Nov 14, 2021 at 6:29 PM Juan Nunez-Iglesias <jni@fastmail.com> wrote:
On 15 Nov 2021, at 8:23 am, Stefan van der Walt <stefanv@berkeley.edu> wrote:
On Sun, Nov 14, 2021, at 09:13, Charles R Harris wrote:
The black formatter is much improved in its latest version and I think good enough to start using. The main drawbacks that I see are:
all operators, including '*' and '/', get spaces around them, very long strings are not broken into multiple lines, lists, tuples, and function signatures are either on one line, or broken into multiple lines of one element/argument each, the formatting of extended logical expressions could be improved to emphasize the priority of 'and' over 'or' operators
We've also been having a conversation around mathematical formatting here: https://discuss.scientific-python.org/t/how-to-format-mathematical-expressio...
I tried yapf recently, and was pleased with the output. One concern about yapf was that it has many configuration options: but the only important thing is that you fix the knobs, then you simply have a different version of black.
In my experience, while none of these tools are perfect, not having to have discussions around formatting is completely worth it!
+1 on everything Stéfan said. I never liked black’s formatting, but I have *absolutely* appreciated having zero discussions/push commits/code suggestions to deal with formatting in napari. I have since added yapf to my own repos with a config I like *and* added yapf auto-formatting-on-save to my VSCode, and I don’t even have to have formatting discussions with *myself* anymore. 😂 It’s very liberating!
For reference, here’s my yapf config:
https://github.com/jni/skan/blob/74507344b4cd4453cc43b4dbd0b5742fc08eb5a0/.s...
As Stéfan said, fix the knobs (yours might be different), then forget about it!
Oh, and yes, yapf does allow formatting only the diff. I agree that reformatting the entire code base is problematic.
Juan. _______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-leave@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: ndbecker2@gmail.com
-- Those who don't understand recursion are doomed to repeat it