-
Notifications
You must be signed in to change notification settings - Fork 303
/
.pre-commit-config.yaml
50 lines (45 loc) · 1.72 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: check-ast
- id: check-yaml
- repo: local
hooks:
- id: check-typing-imports
name: Check for Dict/List usage
entry: bash -c 'echo "Checking for typing imports..." && find . -name "*.py" | xargs grep -n "from typing.*import.*[^d]Dict\\|from typing.*import.*List" || exit 0 && echo "⚠️ Please import dict/list instead of Dict/List from typing" && exit 1'
language: system
types: [python]
pass_filenames: false
- repo: local
hooks:
- id: check-print-statements
name: Check for print statements
entry: bash -c 'echo "Checking for print statements..." && find . -name "*.py" ! -path "./py/cli/*" ! -path "./py/core/examples/*" ! -path "./py/migrations/*" ! -path "./py/tests/*" | xargs grep -n "print(" || exit 0 && echo "Found print statements!" && exit 1'
language: system
types: [python]
pass_filenames: false
- repo: local
hooks:
- id: isort
name: isort
entry: bash -c 'cd py && poetry run isort $(git diff --cached --name-only --diff-filter=ACM | grep ".py$" | xargs -I {} echo ../{}) || true'
language: system
types: [python]
pass_filenames: false
- id: black
name: black
entry: bash -c 'cd py && poetry run black .'
language: system
types: [python]
pass_filenames: false
- id: mypy
name: mypy
entry: bash -c 'cd py && poetry run mypy .'
language: system
types: [python]
pass_filenames: false