-
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
.pre-commit-config.yaml
211 lines (199 loc) · 6.58 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-ast
exclude: ^(packages/grid/ansible/)
always_run: true
- id: trailing-whitespace
always_run: true
exclude: ^(docs/|.+\.md|.bumpversion.cfg)
- id: check-docstring-first
always_run: true
exclude: ^(packages/grid/ansible/)
- id: check-json
always_run: true
exclude: ^(packages/grid/frontend/)
- id: check-added-large-files
always_run: true
exclude: ^(packages/grid/backend/wheels/.*|docs/img/header.png|docs/img/terminalizer.gif)
- id: check-yaml
always_run: true
exclude: ^(packages/grid/k8s/rendered/|packages/grid/helm/)
- id: check-merge-conflict
always_run: true
args: ["--assume-in-merge"]
- id: check-executables-have-shebangs
always_run: true
exclude: ^(packages/grid/ansible/)
- id: debug-statements
always_run: true
exclude: ^(packages/grid/ansible/)
- id: name-tests-test
always_run: true
exclude: ^(.*/tests/utils/)|^(.*fixtures.py)
- id: requirements-txt-fixer
always_run: true
- id: mixed-line-ending
args: ["--fix=lf"]
exclude: '\.bat|\.csv|\.ps1$'
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
args: ["--never", "--application-directories=packages/syft/src"]
always_run: true
files: ^packages/syft/src
exclude: |
(?x)^(
packages/syft/examples/.*|
packages/syft/src/syft/proto.*|
packages/syft/tests/syft/lib/python.*|
packages/grid.*|
packages/hagrid.*|
packages/syft/src/syft/federated/model_serialization/protos.py
)$
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
name: "absolufy-imports: syft-cli"
always_run: true
files: ^packages/syftcli
# This will ignore all syftcli/**/*.py where relative imports are okay
# but absolufy only top-level syftcli/<file>.py. where relative imports are not okay for pyinstaller
exclude: ^packages/syftcli/syftcli/(.*)/
args: ["--application-directories=packages/syftcli/"]
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort
args: [".", "--settings-path .isort.cfg"]
always_run: true
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.3
hooks:
- id: nbqa-isort
- id: nbqa-black
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: "v0.3.0"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
types_or: [python, pyi, jupyter]
- id: ruff-format
types_or: [python, pyi, jupyter]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
name: "mypy: hagrid"
always_run: true
files: ^packages/hagrid
args: [
"--ignore-missing-imports",
"--scripts-are-modules",
"--disallow-incomplete-defs",
"--no-implicit-optional",
"--warn-unused-ignores",
"--warn-redundant-casts",
"--strict-equality",
"--warn-unreachable",
# "--disallow-untyped-decorators",
"--disallow-untyped-defs",
"--disallow-untyped-calls",
"--namespace-packages",
"--install-types",
"--non-interactive",
"--config-file=tox.ini",
]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
name: "mypy: syft-cli"
always_run: true
files: ^packages/syftcli
args: [
"--ignore-missing-imports",
"--scripts-are-modules",
"--disallow-incomplete-defs",
"--no-implicit-optional",
"--warn-unused-ignores",
"--warn-redundant-casts",
"--strict-equality",
"--warn-unreachable",
# "--disallow-untyped-decorators",
"--disallow-untyped-defs",
"--disallow-untyped-calls",
"--namespace-packages",
"--install-types",
"--non-interactive",
"--config-file=tox.ini",
]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
name: "mypy: grid"
files: ^packages/grid
always_run: true
args: [
"--ignore-missing-imports",
"--scripts-are-modules",
"--disallow-incomplete-defs",
"--no-implicit-optional",
"--warn-unused-ignores",
"--warn-redundant-casts",
"--strict-equality",
"--warn-unreachable",
# "--disallow-untyped-decorators",
"--disallow-untyped-defs",
"--disallow-untyped-calls",
"--namespace-packages",
"--install-types",
"--non-interactive",
"--config-file=tox.ini",
]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
name: "mypy: syft"
always_run: true
files: "^packages/syft/src/syft/"
exclude: "packages/syft/src/syft/types/dicttuple.py|^packages/syft/src/syft/service/action/action_graph.py"
args: [
"--follow-imports=skip",
"--ignore-missing-imports",
"--scripts-are-modules",
"--disallow-incomplete-defs",
"--no-implicit-optional",
# "--warn-unused-ignores",
"--warn-redundant-casts",
"--strict-equality",
"--warn-unreachable",
# "--disallow-untyped-decorators",
"--disallow-untyped-defs",
"--disallow-untyped-calls",
"--install-types",
"--non-interactive",
"--config-file=tox.ini",
]
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
files: "^notebooks/api|^notebooks/tutorials"
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.9-for-vscode"
hooks:
- id: prettier
exclude: ^(packages/grid/helm|packages/grid/frontend/pnpm-lock.yaml|packages/hagrid/hagrid/manifest_template.yml)
# - repo: meta
# hooks:
# - id: identity
# always_run: true
# files: "notebooks/api/*"