-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Adopt, promote, and enforce *automatic* code formatting #340
Description
Is your feature request related to a problem? Please describe.
This is a suggestion. I have found that after initial fighting over the minutia of sub-optimal results for a small number of points, the benefit of having automated consistent formatting (even if there are some compromises in how some/most developers would like the code to look ) is huge.
Describe the solution you'd like
This is a suggestion, there are other auto-formatters available, this one just works really well on the projects I have used it on. Additionally, many IDE's have support for direct integration.
Github action: https://github.com/lgeiger/black-action
https://github.com/psf/black
Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatting. In return, Black gives you speed, determinism, and freedom from pycodestyle nagging about formatting. You will save time and mental energy for more important matters.
Blackened code looks the same regardless of the project you're reading. Formatting becomes transparent after a while and you can focus on the content instead.
Black makes code review faster by producing the smallest diffs possible.
Try it out now using the Black Playground. Watch the PyCon 2019 talk to learn more.
Describe alternatives you've considered
I've tried other auto-formatters with more configuration options. They provide more developer choice and configuration, but that is a burden that they have been less consistent with producing small diffs in PR's, have been unreliable, or cause huge diffs if a minor configuration issue is introduced (i.e. they can have a large community developer burden).
Additional context
I have worked on many community-supported projects (ITK being the most prominent). Code checking without automated formatting support is a huge burden on community developers and is often the point of frustration that drives developers away from contributing to projects.
After adding Github actions for auto-formatting, the velocity of community contributions greatly increased, the reviewer burden decreased, and the code style was consistent.