-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
93 lines (87 loc) · 2.73 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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
# https://pre-commit.com/#meta-hooks
- repo: meta
hooks:
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: fix-encoding-pragma
args:
- --remove
- id: forbid-new-submodules
always_run: true
- id: mixed-line-ending
- id: trailing-whitespace
- repo: local
hooks:
# https://black.readthedocs.io/en/stable/
# https://github.com/psf/black/blob/main/.pre-commit-hooks.yaml
- id: black
name: black (local)
description: Run black code formatter
entry: python -m black
language: system
require_serial: true
types_or:
- python
- pyi
# https://pycqa.github.io/isort/
# https://github.com/PyCQA/isort/blob/main/.pre-commit-hooks.yaml
- id: isort
name: isort (local)
description: Run isort import formatter
entry: python -m isort
language: system
require_serial: true
types_or:
- python
- pyi
args:
- --jobs=-1
- --python-version=auto
- --settings=pyproject.toml
# https://flake8.pycqa.org/en/latest/
# https://github.com/PyCQA/flake8/blob/main/.pre-commit-hooks.yaml
- id: flake8
name: flake8 (local)
description: Run flake8 style linter
entry: python -m flake8
language: system
require_serial: true
types_or:
- python
- pyi
args:
- --max-line-length=120
# https://python-poetry.org/docs/pre-commit-hooks/
# https://github.com/python-poetry/poetry/blob/master/.pre-commit-hooks.yaml
- id: poetry-check
name: poetry check (local)
description: Ensure pyproject.toml file is valid
entry: poetry check -n
language: system
pass_filenames: false
files: ^pyproject\.toml$
- id: poetry-lock
name: poetry lock (local)
description: Ensure lock file is up-to-date
entry: bash -c 'poetry check --lock -n || poetry lock -n --no-update'
language: system
pass_filenames: false
files: ^(pyproject\.toml|poetry\.lock)$