Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

A code formatter like Black can handle that. It's there to enforce a single code style no matter what the contributors use, whether they are human or AI.
 help



Black's default, which I like, has it keep any vertical spacing of comma separated things like function arguments or list contents if they end with a trailing comma. I'm not sure there's an easy way to make a "don't break up short function signatures" rule, but would love to hear if anyone's done anything like that.

Not sure if you can still read my late reply, but Black has a `--skip-magic-trailing-comma` flag:

> By default, Black uses existing trailing commas as an indication that short lines should be left separate, as described in the style documentation. If this option is given, the magic trailing comma is ignored.

https://black.readthedocs.io/en/stable/usage_and_configurati...

It should then keep the lines intact, unless they exceed the line length. I have mine set to 120.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: