-
Notifications
You must be signed in to change notification settings - Fork 29
/
.pre-commit-config.yaml
51 lines (51 loc) · 1.85 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
# Exclude hidden files, init, tensorrt folders, protobuf generated files, markdown files, and DB model.py files
exclude: ^(.*/\..*|.*__init__.py|.*_pb2.py|.*_pb2_grpc.py|.*.md|.*.database.*.models.py)$
default_language_version:
python: python3.9
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast # check if valid python file
stages: [commit]
- id: debug-statements # check if left in debug statements
stages: [commit]
- id: trailing-whitespace # remove trailing whitespace
stages: [commit]
- id: end-of-file-fixer # have one line at end of file
stages: [commit]
- id: check-docstring-first # File comments should come before imports
stages: [commit]
- id: check-yaml # make sure valid yaml
stages: [commit]
- id: name-tests-test # check that tests start with test_*
args: ['--pytest']
stages: [commit]
exclude: ^tests/helpers/
- id: check-added-large-files # check that we're not committing big files to git, excluding lfs files.
args: ['--maxkb=2000'] # set max file size to 2MB
stages: [commit]
- repo: https://github.com/asottile/pyupgrade # use Python3 tricks
rev: v2.32.0
hooks:
- id: pyupgrade
args: ['--keep-percent-format', '--keep-runtime-typing']
stages: [commit]
- repo: https://github.com/pre-commit/mirrors-isort # Sort imports, similar to PyCharm organize imports
rev: v5.10.1
hooks:
- id: isort
args: ['--line-length=120', '--profile=black']
stages: [commit]
- id: isort
args: ['--line-length=120', '--profile=black', '--check']
stages: [manual]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: ['--line-length=120', '--skip-string-normalization']
stages: [commit]
- id: black
args: ['--line-length=120', '--skip-string-normalization', '--check']
stages: [manual]