Skip to content

Commit

Permalink
pre-commit: Add hook for yapf-diff (#1246)
Browse files Browse the repository at this point in the history
  • Loading branch information
avalanche-pwn authored Oct 5, 2024
1 parent 0de7684 commit ed70540
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@
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)"

0 comments on commit ed70540

Please sign in to comment.