|
|
|
|
|
by wting
4094 days ago
|
|
FWIW, at Yelp we built and open sourced pre-commit (http://pre-commit.com/) that runs a bunch of hooks on git commits. One of the most commonly used hooks is `autopep8 -i` which will automatically formats code on commit. As yapf documentation has pointed out, pep8 is vague about certain things (i.e. indention). Yelp prefers an indention style where multiple arguments are broken up 1 per line and has a pre-commit hook to automatically enforce that. yapf is also opinionated about indentation, preferring vertical alignment. I've run it on an open source project to illustrated the differences (YelpDent vs yapf indent): def remove_user_data(dryrun=False):
if platform.system() == 'Darwin':
- data_home = os.path.join(
- os.path.expanduser('~'),
- 'Library',
- 'autojump')
+ data_home = os.path.join(os.path.expanduser('~'), 'Library',
+ 'autojump')
elif platform.system() == 'Windows':
data_home = os.path.join(os.getenv('APPDATA'), 'autojump')
else:
- data_home = os.getenv(
- 'XDG_DATA_HOME',
- os.path.join(
- os.path.expanduser('~'),
- '.local',
- 'share',
- 'autojump'))
+ data_home = os.getenv('XDG_DATA_HOME',
+ os.path.join(os.path.expanduser('~'), '.local',
+ 'share', 'autojump'))
|
|
Ultimately, we'd like to have these things configurable via the style settings of yapf, so multiple detailed styles can be selected.
Patches welcome :)