-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
75 lines (67 loc) · 3.43 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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# Use: `pre-commit autoupdate` to update the hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files # prevents giant files from being committed.
- id: check-case-conflict # checks for files that would conflict in case-insensitive filesystems.
- id: check-merge-conflict # checks for files that contain merge conflict strings.
- id: trailing-whitespace # trims trailing whitespace.
- id: check-yaml # checks yaml files for parseable syntax.
- id: check-toml # checks toml files for parseable syntax.
- id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline.
- id: mixed-line-ending # replaces or checks mixed line ending.
- id: detect-private-key # detects the presence of private keys.
- id: fix-byte-order-marker # removes utf-8 byte order marker.
- id: check-executables-have-shebangs # ensures that (non-binary) executables have a shebang.
# - id: check-shebang-scripts-are-executable # ensures that (non-binary) files with a shebang are executable.(raises false positives on macOS)
# A tool to automatically upgrade syntax for newer versions of the python language.
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: [ --py310-plus ]
# A formatter for finding and removing unused import statements.
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.2
hooks:
- id: pycln
args: [ --all ]
# Import order and formatting
# If used jointly with flake8-import-order, ensure that flake8 import order
# is set to the same style that is enforced by zimports.
# E.g. add `import-order-style = google` to your .flake8 file.
- repo: https://github.com/sqlalchemyorg/zimports/
rev: v0.6.0
hooks:
- id: zimports
args: [ --style=pycharm ]
# The uncompromising code formatter
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
language_version: python3.10
# A tool to automatically fix common style issues in Python code. Has plugins.
- repo: https://github.com/pycqa/flake8
# keep '5.0.4'
rev: '5.0.4'
hooks:
- id: flake8
args: [ --radon-max-cc, "8", --max-function-length, "50" ]
exclude: (__pycache__|.venv|tmp|.tox|experiments)
additional_dependencies: [ flake8-import-order, flake8-keyword-arguments, flake8-bugbear, flake8-docstrings, radon, flake8-functions ]
# Find common security issues in your Python code using bandit.
- repo: https://github.com/Lucas-C/pre-commit-hooks-bandit
rev: v1.0.6
hooks:
- id: python-bandit-vulnerability-check
args: [ -r, --ini, .bandit ]
# monitor code’s complexity
- repo: https://github.com/rubik/xenon
rev: v0.9.0
hooks:
- id: xenon
args: [ --max-absolute B, --max-modules A, --max-average A ]