5 ms·
We use Black in a pre-commit hook for all our python code. It makes legibility and formatting a non-issue in the team. Yes it can look strange at first if you'r
by fredley 7y ago
We use Black in a pre-commit hook for all our python code. It makes legibility and formatting a non-issue in the team. Yes it can look strange at first if you're not used to it, but after a while it makes formatting invisible (and it's odd reading non-black python). Would recommend.
- mlevental 7y agohow do you do this? do you have a jenkins server running that does the formatting? i would love to set this up because while i use black religiously i cannot for the life of me convince my boss get in the habit of using it (which is crazy because your commits are always fighting on whitespace).
- guitarbill 7y agoUse pre-commit [0] so people can run it client side for quick feedback, and then use whatever CI you have (Jenkins, Travis, Circle, Azure) to enforce this. The important parts are the majority of people agree to do it, and that you have CI to be the "bad cop"/fall guy so it never becomes personal. (edit: black has pre-commit support [1], and it's easier than setting up and maintaining your own hooks IMO) [0] https://pre-commit.com/ https://pre-commit.com/ [1] https://github.com/python/black/blob/master/README.md#version-control-integration https://github.com/python/black/blob/master/README.md#versio...
- devvesa 7y agoBlack's README explains how to do it: https://github.com/python/black#version-control-integration https://github.com/python/black#version-control-integration
- c0un7d0wn 7y agoSee https://github.com/shosca/django-sorcery/blob/master/Makefile#L44 https://github.com/shosca/django-sorcery/blob/master/Makefil... for example Run that target as part of the test