-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
118 lines (106 loc) · 3.08 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Configuration-file for pre-commit
# References:
# - Official docs: https://pre-commit.com
# - for more hooks: https://pre-commit.com/hooks.html
#
# To avoid duplication, we try to configure the tools in pyproject.toml as much as possible.
#
# We prepend "poetry run" to every command to make it work without activatig the python-virtualenv
#
# Usage:
# > bin/pre-commit install
# > bin/pre-commit install hooks -f
# > bin/pre-commit autoupdate
# > bin/pre-commit run --all-files
repos:
# docs: https://black.readthedocs.io/en/stable/integrations/source_version_control.html
- repo: local
hooks:
- id: black
name: black
entry: poetry run black
args: [
"--config=pyproject.toml", # not needed, is default?
]
# "--check", # don't write the files back, just return the status.
language: system # use executable found on path
types: [python] # check only specific filetypes
# docs: https://flake8.pycqa.org/en/latest/user/using-hooks.html
- repo: local
hooks:
- id: flake8
name: flake8
entry: poetry run flake8
language: system
types: [python]
# docs: https://pycqa.github.io/isort/docs/configuration/pre-commit.html
- repo: local
hooks:
- id: isort
name: isort
entry: poetry run isort
args: ["--settings-path=pyproject.toml"]
language: system
- repo: local
hooks:
- id: mypy
name: mypy
entry: poetry run mypy
language: system
types: [python]
# - repo: local
# hooks:
# - id: bandit
# name: bandit
# entry: bandit
# language: system
# types: [python]
# # see https://github.com/PyCQA/bandit/issues/318
# args: [
# "--configfile pyproject.toml",
# "--baseline etc/bandit-baseline.json",
# ]
# The following are all pre-commit-hooks
# docs: https://github.com/pre-commit/pre-commit-hooks
- repo: local
hooks:
- id: debug-statements
name: check-debug-statements
entry: poetry run debug-statement-hook
language: system
types: [python]
- repo: local
hooks:
- id: check-toml
name: check-toml
entry: poetry run check-toml
language: system
types: [toml]
- repo: local
hooks:
- id: end-of-file-fixer
name: fix-end-of-filer
entry: poetry run end-of-file-fixer
language: system
types: [python]
- repo: local
hooks:
- id: fix-encoding-pragma
name: fix-encoding-pragma
entry: poetry run fix-encoding-pragma --remove
language: system
types: [python]
- repo: local
hooks:
- id: mixed-line-ending
name: fix-mixed-line-ending
entry: poetry run mixed-line-ending
language: system
types: [text]
- repo: local
hooks:
- id: trailing-whitespace
name: fix-trailing-whitespace
entry: poetry run trailing-whitespace-fixer
language: system
types: [text]