blob: e834fc4dba37472b19813e18357c32d1880a0b65 [file] [log] [blame] [edit]
# File configures YAPF to be used as a git hook with https://github.com/pre-commit/pre-commit
- id: yapf
name: yapf
description: "A formatter for Python files."
entry: yapf
args: [-i] #inplace
language: python
types: [python]
- id: yapf-diff
name: yapf-diff
description: "A formatter for Python files. (formats only changes included in commit)"
always_run: true
language: python
pass_filenames: false
stages: [pre-commit]
entry: |
bash -c "git diff -U0 --no-color --relative HEAD \
| yapf-diff \
| tee >(git apply --allow-empty -p0)"