-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpyproject.toml
390 lines (371 loc) · 12.8 KB
/
pyproject.toml
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
[project]
name = 'system_tests'
version = '0.0.1'
dynamic = ["dependencies"]
[tool.setuptools]
packages = ["tests", "utils", "manifests"]
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
[tool.pytest.ini_options]
addopts = "--json-report --json-report-indent=2 --color=yes --no-header --junitxml=reportJunit.xml -r Xf"
testpaths = [
"tests",
]
# log_cli = True
# log_cli_level = DEBUG
log_level = "DEBUG"
log_format = "%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s"
log_date_format = "%H:%M:%S"
log_file_format = "%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s"
log_file_date_format = "%H:%M:%S"
junit_family = "xunit2"
junit_logging = "no"
junit_duration_report = "call"
junit_suite_name = "system_tests_suite"
markers =[
"scenario: run a test only for a specified scenario",
"features: declare the feature id"
]
python_files = "test_*.py *utils.py"
[tool.mypy]
files = [
"utils/",
"tests/",
"conftest.py",
]
exclude = [
"utils/build/.*", # more permissive on weblog codes
"utils/grpc/weblog_pb2.py", # auto generated
# TODO
"tests/fuzzer/.*",
"tests/test_the_test/.*",
"tests/test_telemetry.py",
"tests/appsec/.*",
"tests/debugger/.*",
"tests/auto_inject/.*",
"tests/integrations/.*",
"tests/otel_tracing_e2e/test_e2e.py",
"tests/k8s_lib_injection/test_k8s_init_image_validator.py",
"utils/_context/_scenarios/auto_injection.py",
"utils/_context/_scenarios/k8s_lib_injection.py",
"utils/_context/core.py",
"utils/_context/virtual_machines.py",
"utils/scripts/decode-rc.py",
"utils/docker_ssi/.*",
"utils/k8s_lib_injection/.*",
"utils/onboarding/.*",
"utils/otel_validators/validator_trace.py",
"utils/proxy/_deserializer.py",
"utils/scripts/merge_gitlab_aws_pipelines.py",
"utils/virtual_machine/.*",
]
ignore_missing_imports = true
check_untyped_defs = true
disable_error_code = ["no-redef"]
follow_imports = "skip"
# enable_error_code = ["ignore-without-code"]
[tool.ruff]
line-length = 120
indent-width = 4
target-version = "py312"
[tool.ruff.format]
exclude = [
"venv/",
"utils/grpc/weblog_pb2_grpc.py",
"utils/grpc/weblog_pb2.py", "parametric/apps",
"lib-injection/build/docker/python/dd-lib-python-init-test-protobuf-old/addressbook_pb2.py"
]
quote-style = "double"
indent-style = "space"
# skip-magic-trailing-comma = false
# line-ending = "auto"
# docstring-code-format = false
# docstring-code-line-length = "dynamic"
[tool.ruff.lint]
exclude = [
"docs/*",
]
select = ["ALL"]
ignore = [
### TODO : remove those ignores
# missing-type-annotation, the ONE to remove !!
"ANN001",
"ANN003",
"ANN202",
"BLE001", # Do not catch blind exception: `Exception`, big project to enable this
"C901", # code complexity, TBD
"E722", # bare except, big project to enable this
"PERF401", # TBD, the "good" code can be harder to read
"PLR0911", # too many return, may be replaced by a higher default value
"PLR0912", # Too many branches
"PLR0913", # too many arguments, may be replaced by a higher default value
"PLR0915", # too many statements, may be replaced by a higher default value
"PLR1714",
"PLR2004",
"PTH118",
"PTH123", # `open()` should be replaced by `Path.open()`
"RUF012",
"S202",
"SIM102",
"SIM110", # TBD
"TRY003", # this is a full project to enable this
### Ignores that will be kept for the entire project
"ANN204", # missing-return-type-special-method
"COM812", # ruff format recommend ignoring this
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D107", # Missing docstring in `__init__`
"D202", # blank line after docstring
"D203", # cause a warning
"D205", # PEP 257 : blank line after first docstring line
"D211", # no-blank-line-before-class
"D213", # multi-line-summary-second-line
"D400", # First line should end with a period
"D401", # PEP 257 : blank line after first docstring line
"D406", # we are not using numpy convention for docstrings
"D407", # we are not using reStructuredText for docstrings
"D415", # First line should end with a period
"EM101", # Exception must not use a string literal => painful
"EM102", # Exception must not use an f-string => painful
"ERA001", # Found commented-out code
"FIX001", # Fixme found
"FIX002", # Fixme found
"G004", # allow logging with f-string
"I001", # Import block is un-sorted or un-formatted
"ISC001", # ruff format recommend ignoring this
"PTH207", # allow using glob.glob
"S101", # we allow assert!
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -> it's testing
"S324", # testing, it's fine
"S603", # allow untrusted input for subprocess
"S607", # allow relative process call
"TD001", # todo found
"TD002", # todo found
"TD003", # todo found
"TD004", # todo found
"TRY300", # not always obvious
"UP015", # redundant-open-modes: yes it's redundant. But explicit is better than implicit
"UP038", # not a big fan
]
[tool.ruff.lint.per-file-ignores]
"utils/grpc/weblog_pb2_grpc.py" = ["ALL"]
"utils/grpc/weblog_pb2.py" = ["ALL"]
"utils/scripts/*" = [
"INP001", # this is not a package
"T201" # allow print statements in scripts folder
]
"utils/interfaces/schemas/serve_doc.py" = [
"INP001", # this is not a package
"ANN201"
]
"utils/waf_rules.py" = ["N801"] # generated file
# TODO : remove those ignores
"tests/*" = [
# lines with [*] can be autofixed with ruff check --fix --unsafe-fixes
# though, each change must be reviewed
"ANN201", # 2043 occurences [ ] missing-return-type-undocumented-public-function
"N801", # 492 occurences [ ] invalid-class-name
"ARG002", # 177 occurences [ ] unused-method-argument
"E501", # 159 occurences [ ] line-too-long
"SIM117", # 127 occurences [ ] multiple-with-statements
"TID252", # 77 occurences [*] relative-imports
"N806", # 76 occurences [ ] non-lowercase-variable-in-function
"FBT003", # 67 occurences [ ] boolean-positional-value-in-call
"D200", # 52 occurences [*] fits-on-one-line
"F405", # 43 occurences [ ] undefined-local-with-import-star-usage
"TRY002", # 41 occurences [ ] raise-vanilla-class
"PT018", # 39 occurences [ ] pytest-composite-assertion
"N802", # 39 occurences [ ] invalid-function-name
"FBT002", # 30 occurences [ ] boolean-default-value-positional-argument
"D404", # 25 occurences [ ] docstring-starts-with-this
"ANN401", # 24 occurences [ ] any-type
"B007", # 23 occurences [ ] unused-loop-control-variable
"DTZ005", # 23 occurences [ ] call-datetime-now-without-tzinfo
"INP001", # 22 occurences [ ] implicit-namespace-package
"ARG001", # 21 occurences [ ] unused-function-argument
"UP031", # 17 occurences [ ] printf-string-formatting
"ANN205", # 16 occurences [ ] missing-return-type-static-method
"T201", # 15 occurences [*] print
"FBT001", # 12 occurences [ ] boolean-type-hint-positional-argument
"SLF001", # 12 occurences [ ] private-member-access
"UP035", # 12 occurences [ ] deprecated-import
"S105", # 10 occurences [ ] hardcoded-password-string
"B015", # 10 occurences [ ] useless-comparison
"RET503", # 9 occurences [*] implicit-return
"SIM115", # 9 occurences [ ] open-file-with-context-handler
"PGH004", # 9 occurences [ ] blanket-noqa
"RUF001", # 9 occurences [ ] ambiguous-unicode-character-string
"RUF015", # 9 occurences [*] unnecessary-iterable-allocation-for-first-element
"SIM108", # 8 occurences [*] if-else-block-instead-of-if-exp
"PTH120", # 8 occurences [ ] os-path-dirname
"PGH003", # 8 occurences [ ] blanket-type-ignore
"TRY301", # 8 occurences [ ] raise-within-try
"ANN206", # 7 occurences [ ] missing-return-type-class-method
"B011", # 7 occurences [*] assert-false
"PT015", # 7 occurences [ ] pytest-assert-always-false
"N815", # 7 occurences [ ] mixed-case-variable-in-class-scope
"PT006", # 6 occurences [*] pytest-parametrize-names-wrong-type
"N803", # 6 occurences [ ] invalid-argument-name
"E741", # 6 occurences [ ] ambiguous-variable-name
"S113", # 5 occurences [ ] request-without-timeout
"PT011", # 5 occurences [ ] pytest-raises-too-broad
"E731", # 5 occurences [*] lambda-assignment
"RUF005", # 5 occurences [ ] collection-literal-concatenation
"PTH103", # 4 occurences [ ] os-makedirs
"PLW2901", # 4 occurences [ ] redefined-loop-name
"PTH112", # 3 occurences [ ] os-path-isdir
"ANN002", # 2 occurences [ ] missing-type-args
"ASYNC230", # 2 occurences [ ] blocking-open-call-in-async-function
"S605", # 2 occurences [ ] start-process-with-a-shell
"PTH100", # 2 occurences [ ] os-path-abspath
"PTH109", # 2 occurences [ ] os-getcwd
# keep those exceptions
"C400", # unnecessary-generator-list: explicit list is more readable for non-python users
"C401", # unnecessary-generator-set: explicit set is more readable for non-python users
"C408", # unnecessary-collection-call: explicit tuple is more readable for non-python users
"C416", # unnecessary-comprehension: may make the code less readable for non-python users
"FIX003", # line-contains-xxx: freedom of speech!
"FIX004", # line-contains-xxx: freedom of speech!
"PLR1730", # if-stmt-min-max: not clear that it makes the code easier to read
"RET506", # superfluous-else-raise: requires a slightly higher cognitive effort to understand the code
"RET507", # superfluous-else-continue : requires a slightly higher cognitive effort to understand the code
"RET508", # superfluous-else-break: requires a slightly higher cognitive effort to understand the code
"RET505", # superfluous-else-return: requires a slightly higher cognitive effort to understand the code
"S108", # hardcoded-temp-file: test code may contains weird things
]
"utils/build/*" = ["ALL"]
"lib-injection/*" = ["ALL"]
"utils/{k8s_lib_injection/*,_context/_scenarios/k8s_lib_injection.py}" = [
"ANN201",
"TRY201",
"TRY002",
"D207",
"SIM115",
"S603",
"DTZ005",
"E501", # line too long
"FBT002", # Boolean default positional argument
"SLF001",
"RET505",
"TRY301",
"B006",
"SIM108",
"RET508",
"B007",
"E712",
"F541",
"TRY400",
"N818",
"UP004",
"PTH109",
"UP032",
"EM103",
"B904",
"PTH108",
"A002",
"E401",
"RUF012",
"G002",
"UP031",
"F541"
]
"utils/onboarding/*" = [
"ANN201",
"DTZ006",
"DTZ005",
"E501", # line too long
"FBT002", # Boolean default positional argument
"UP017",
"N806",
"FBT001",
"S507",
"PTH102",
"PLR2044",
"N803",
"RET505",
]
"utils/docker_ssi/*" = [
"ANN201",
"ANN205",
]
"utils/{_context/_scenarios/docker_ssi.py,docker_ssi/docker_ssi_matrix_builder.py,docker_ssi/docker_ssi_matrix_utils.py}" = [
"ANN201",
"PLR2004",
"E501", # line too long
"SIM210",
"RET504",
"RET505",
"SIM108",
"T201",
]
"utils/_context/virtual_machines.py" = [
"ARG002", # unused method argument
"FBT002", # Boolean default positional argument
"N801", # class naming
"S507", # Paramiko call with policy set to automatically trust the unknown host key
]
"utils/virtual_machine/*" = [
"A002",
"ANN002",
"ANN201",
"ARG001",
"ARG002",
"C901",
"E712",
"E731",
"E501", # line too long
"FBT002", # Boolean default positional argument
"F541",
"E713",
"EM102",
"PLR0912",
"PLR0915",
"PLW1510",
"PTH112",
"PTH113",
"PTH116",
"PTH118",
"PTH119",
"RET503",
"RET504",
"RET508",
"RET505",
"RUF013",
"S506",
"S603",
"SIM102",
"SIM113",
"SIM300",
"SIM401", # code quality, TBD
"UP008",
"UP031",
"UP024",
"BLE001",
"D207",
"F401",
"F811",
"F841",
"N802",
"N803",
"N806",
"PERF401",
"PLR2004",
"PTH101",
"PTH102",
"PTH109",
"S103",
"S113",
"S311",
"S602",
"SIM103",
"SIM115",
"SLF001",
"TRY002",
]
"utils/_features.py" = [
"ANN205" #obvious decorators
]