forked from mantiumai/chirps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
81 lines (76 loc) · 2.32 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
repos:
# Miscellaneous checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-toml
# - id: check-json
- id: check-yaml
args: ["--unsafe"]
# - id: pretty-format-json
# args:
# - --no-ensure-ascii
# - --autofix
# isort alphabetizes your python imports and groups them
# The 'black' profile helps us avoid disagreements with the blue formatter.
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
types: [python]
args:
- -l=120
- --py=39
- --profile=black
- --filter-files
- --skip-gitignore
# blue auto-formats python files for us
- repo: https://github.com/grantjenks/blue.git
rev: v0.9.1
hooks:
- id: blue
types: [python]
args:
- -l120
- -tpy39
- --exclude="(\.gitlab)"
# pydocstyle checks docstring styles after blue is done reformatting
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
types: [python]
exclude: '^.*/migrations/.*$|test_.+\.py'
args:
- --config=.pydocstyle
# After blue is done reformatting everything, double check it with flake8
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
types: [python]
args:
- --max-line-length=120
- --extend-ignore=E203
# mypy validates the python typing as per PEP 484
# See https://jaredkhan.com/blog/mypy-pre-commit for the source of this
- repo: local
# We do not use pre-commit/mirrors-mypy,
# as it comes with opinionated defaults
# (like --ignore-missing-imports)
# and is difficult to configure to run
# with the dependencies correctly installed.
hooks:
- id: mypy
name: mypy
entry: "./scripts/run-mypy"
# A script hook uses the active virtual environment, so it must be up-to-date with `poetry install --sync`
language: script
types_or: [python, toml]
# use require_serial so that script
# is only called once per commit
require_serial: true
# Print the number of files as a sanity-check
verbose: true