File: .pre-commit-hooks.yaml

package info (click to toggle)
yapf 0.43.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,432 kB
  • sloc: python: 18,992; sh: 33; makefile: 7
file content (21 lines) | stat: -rw-r--r-- 602 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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)"