-
Notifications
You must be signed in to change notification settings - Fork 6
/
.pre-commit-config.yaml
74 lines (73 loc) · 4.21 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
# https://pre-commit.com/hooks.html
exclude: ^(docs/|.tox)
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files # Prevent giant files from being committed
- id: check-ast # Simply check whether the files parse as valid python.
- id: check-byte-order-marker # forbid files which have a UTF-8 byte-order marker
- id: check-builtin-literals # Require literal syntax when initializing empty or zero Python builtin types.
- id: check-case-conflict # Check for files that would conflict in case-insensitive filesystems
- id: check-docstring-first # Checks a common error of defining a docstring after code.
- id: check-executables-have-shebangs # Ensures that (non-binary) executables have a shebang.
- id: check-json # This hook checks json files for parseable syntax.
- id: check-shebang-scripts-are-executable # Ensures that (non-binary) files with a shebang are executable.
- id: pretty-format-json # This hook sets a standard for formatting JSON files.
args: ['--autofix']
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: check-symlinks # Checks for symlinks which do not point to anything.
- id: check-toml # This hook checks toml files for parseable syntax.
- id: check-vcs-permalinks # Ensures that links to vcs websites are permalinks.
- id: check-xml # This hook checks xml files for parseable syntax.
- id: check-yaml # This hook checks yaml files for parseable syntax.
- id: debug-statements # Check for debugger imports and py37+ `breakpoint()` calls in python source.
- id: destroyed-symlinks # Detects symlinks which are changed to regular files with a content of a path which that symlink was pointing to.
- id: detect-private-key # Detects the presence of private keys
- id: end-of-file-fixer # Ensures that a file is either empty, or ends with one newline.
- id: fix-byte-order-marker # removes UTF-8 byte order marker
- id: mixed-line-ending # Replaces or checks mixed line ending
- id: sort-simple-yaml # Sorts simple YAML files which consist only of top-level keys, preserving comments and blocks.
- id: trailing-whitespace # This hook trims trailing whitespace.
- repo: local
hooks:
- id: flake8
name: flake8
entry: "flake8 --config ./.flake8"
language: system # will not create a separate virtualenv for the hook and will run it in whatever environment you happen to be in when you run git commit or pre-commit run
types: [python] # trigger for commits changing Python files
require_serial: true # use require_serial so that script is only called once per commit
- id: isort
name: isort
entry: "isort --settings-path=pyproject.toml"
language: system
types: [python]
require_serial: true
- id: black
name: black
entry: "black ."
language: system
types: [python]
require_serial: true
- id: mypy
name: mypy
entry: "mypy --config-file=pyproject.toml"
language: system
types: [python]
require_serial: true
# - id: bandit
# name: bandit
# entry: "bandit -r -c pyproject.toml ."
# language: system
# types: [python]
# require_serial: true
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-check-blanket-noqa # Enforce that noqa annotations always occur with specific codes. Sample annotations: # noqa: F401, # noqa: F401,W203
# - id: python-check-blanket-type-ignore # Enforce that # type: ignore annotations always occur with specific codes. Sample annotations: # type: ignore[attr-defined], # type: ignore[attr-defined, name-defined]
- id: python-check-mock-methods # Prevent common mistakes of assert mck.not_called(), assert mck.called_once_with(...) and mck.assert_called.
- id: python-use-type-annotations # Enforce that python3.6+ type annotations are used instead of type comments
- id: text-unicode-replacement-char # Forbid files which have a UTF-8 Unicode replacement character