-
Notifications
You must be signed in to change notification settings - Fork 2
/
.pre-commit-config.yaml
63 lines (58 loc) · 1.99 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: check-added-large-files
args: [--maxkb=5000]
- id: check-json
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: detect-private-key
- id: end-of-file-fixer
- id: name-tests-test
args: [--django] # to match `test*.py`.
# - id: no-commit-to-branch # to protect specific branches from direct checkins.
# args: [--branch, master]
- id: pretty-format-json
args: [--autofix]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.1
hooks:
- id: flake8
# max-line-length setting is the same as black
# commit cannot be done when cyclomatic complexity is more than 10.
# E402 ... Module level import not at top of file
# PT011 ... set the match parameter in pytest.raises({exception})
# E501 ...Line too long
# E203 ... Whitespace before ':'
# W503 ... Line break occurred before a binary operator
# W504 ... Line break occurred after a binary operator
args: [--max-line-length, "88", "--ignore=E402,PT011,E501,E203,W503,W504", --max-complexity, "10", --max-expression-complexity=7, --max-cognitive-complexity=8]
additional_dependencies: [flake8-bugbear, flake8-builtins, flake8-eradicate, pep8-naming, flake8-expression-complexity, flake8-cognitive-complexity, flake8-pytest-style]
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/isort
rev: 5.5.2
hooks:
- id: isort
args: ["--settings-path=pyproject.toml"]
# for docstrings in python codes
- repo: https://github.com/myint/docformatter
rev: master
hooks:
- id: docformatter
args: [--in-place]
# for markdown
- repo: https://github.com/markdownlint/markdownlint
rev: master # or specific git tag
hooks:
- id: markdownlint
# ignore line length of makrdownlint
args: [-r, ~MD013]