-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.pre-commit-config.yaml
52 lines (47 loc) · 2.36 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# See https://pre-commit.com for more information
# The hooks are all run *inside* the server container. This is done in order to reduce the initial required
# configuration of this project - to increase the likelihood that everything "Just Works(tm)". For instance, the 'black'
# code formatter needs to use the same version of python as is targeted by the server code. By installing the package
# into the server, and then running it there, the correct version of python is guaranteed to be used without any
# additional configuration or installation. If we instead configured the pre-commit hook to pull black from its repo,
# on your host machine, you would have to make sure to install the correct version of python yourself, because
# 'pre-commit install' doesn't install new versions of python.
# This reduction in installation/configuration comes at a small performance cost every time the hooks run. It would be
# reasonable to migrate away from this approach in your own projects, and to change the hooks to instead run on your
# host machine.
# This also means that the pre-commit hooks can't run, and you can't commit, without everything running in kubernetes.
# If this is a problem for some reason, you can pass the '--no-verify' flag to git to skip running pre-commit hooks.
repos:
- repo: local
hooks:
- id: autoflake
name: Remove Unused
language: system
types: [python]
entry: ./dev.sh server-exec /bin/sh -c 'cd .. && autoflake --in-place "$@"' --
- id: isort
name: Sort Imports
language: system
types: [python]
entry: ./dev.sh server-exec /bin/sh -c 'cd .. && isort "$@"' --
- id: black
name: Python Formatting
language: system
types: [python]
entry: ./dev.sh server-exec /bin/sh -c 'cd .. && black "$@"' --
- id: flake8
name: Style Guide Check
language: system
types: [python]
entry: ./dev.sh server-exec /bin/sh -c 'cd .. && flake8 --config setup.cfg "$@"' --
# As your codebase grows, mypy may eventually get too slow to run with every commit.
- id: mypy
name: Type Check
language: system
types: [python]
entry: ./dev.sh server-exec /bin/sh -c 'cd .. && mypy "$@"' --
- id: shellcheck
name: Shell Formatting
language: system
types: [shell]
entry: ./dev.sh server-exec /bin/sh -c 'cd .. && shellcheck "$@"' --