forked from kedro-org/kedro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
128 lines (121 loc) · 5.1 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_stages: [commit, manual]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml # Checks yaml files for parseable syntax.
exclude: "^kedro/templates/|^features/steps/test_starter/"
- id: check-json # Checks json files for parseable syntax.
- id: check-added-large-files
- id: check-case-conflict # Check for files that would conflict in case-insensitive filesystems
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: debug-statements # Check for debugger imports and py37+ `breakpoint()` calls in python source.
exclude: "^kedro/templates/|^features/steps/test_starter/"
- id: requirements-txt-fixer # Sorts entries in requirements.txt
exclude: "^kedro/templates/|^features/steps/test_starter/"
- id: flake8
exclude: "^kedro/templates/|^features/steps/test_starter/"
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.720
hooks:
- id: mypy
args: [--allow-redefinition, --ignore-missing-imports]
exclude: |
(?x)(
^kedro/templates/|
^docs/|
^features/steps/test_starter/
)
- repo: https://github.com/asottile/blacken-docs
rev: v1.9.2
hooks:
- id: blacken-docs
additional_dependencies: [black==21.5b1]
entry: blacken-docs --skip-errors
- repo: local
hooks:
- id: isort
name: "Sort imports"
language: system
types: [file, python]
exclude: ^kedro/templates/|^features/steps/test_starter
entry: isort
- id: black
name: "Black"
language: system
files: ^kedro/|^features/|^tests/
types: [file, python]
exclude: ^features/steps/test_starter|^kedro/templates/
entry: black
- id: legal
name: "Licence check"
language: system
pass_filenames: false
entry: make legal
- id: imports
name: "Import Linter"
language: system
pass_filenames: false
entry: lint-imports
- id: secret_scan
name: "Secret scan"
language: system
exclude: ^features/steps/test_starter
pass_filenames: false
entry: make secret-scan
- id: bandit
name: "Bandit security check"
language: system
types: [file, python]
exclude: ^kedro/templates/|^tests/|^features/steps/test_starter
entry: bandit -ll
# It's impossible to specify per-directory configuration, so we just run it many times.
# https://github.com/PyCQA/pylint/issues/618
# The first set of pylint checks if for local pre-commit, it only runs on the files changed.
- id: pylint-quick-kedro
name: "Quick PyLint on kedro/*"
language: system
types: [file, python]
files: ^kedro/
exclude: ^kedro/templates/
entry: pylint -j 4 --disable=unnecessary-pass
stages: [commit]
- id: pylint-quick-features
name: "Quick PyLint on features/*"
language: system
types: [file, python]
files: ^features/
exclude: ^features/steps/test_starter
entry: pylint -j 4 --disable=missing-docstring,no-name-in-module
stages: [commit]
- id: pylint-quick-tests
name: "Quick PyLint on tests/*"
language: system
types: [file, python]
files: ^tests/
entry: pylint -j 4 --disable=missing-docstring,redefined-outer-name,no-self-use,invalid-name,protected-access,too-many-arguments,too-many-public-methods
stages: [commit]
# The same pylint checks, but running on all files. It's for manual run with `make lint`
- id: pylint-kedro
name: "PyLint on kedro/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint -j 4 --disable=unnecessary-pass --init-hook="import sys; sys.setrecursionlimit(2000)" kedro
- id: pylint-features
name: "PyLint on features/*"
language: system
pass_filenames: false
stages: [manual]
exclude: ^features/steps/test_starter
entry: pylint -j 4 --disable=missing-docstring,no-name-in-module features
- id: pylint-tests
name: "PyLint on tests/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint -j 4 --disable=missing-docstring,redefined-outer-name,no-self-use,invalid-name,protected-access,too-many-arguments,too-many-public-methods tests