-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy path.ruff.toml
More file actions
326 lines (277 loc) · 7.91 KB
/
.ruff.toml
File metadata and controls
326 lines (277 loc) · 7.91 KB
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
line-length = 79 # Accessibility-friendly
namespace-packages = [
"bin/",
"docs/",
"src/awx_plugins/",
"tests/",
]
[format]
quote-style = "single"
[lint]
external = [
"WPS", # Do not remove noqa for wemake-python-style (WPS) checks
]
ignore = [
"CPY001", # Skip copyright notice requirement at top of files
# Legitimate cases, no need to "fix" these violations:
# E501: "line too long", its function is replaced by `flake8-length`
"E501",
"TID252", # `relative-imports`: it's preferred to use relative over absolute
# W505: "doc line too long", its function is replaced by `flake8-length`
"W505",
"A001", # builtin-variable-shadowing # FIXME / noqa
"ARG001", # unused-function-argument # FIXME / noqa
"ARG002", # unused-method-argument # FIXME / noqa
"B904", # raise-without-from-inside-except # FIXME
"BLE001", # blind-except # FIXME
"FURB101", # read-whole-file # FIXME
# Refs:
# * https://github.com/astral-sh/ruff/issues/6606
# * https://github.com/astral-sh/ruff/pull/13286
"DOC201", # Ruff doesn't understand sphinx-native param lists
"DOC402", # Ruff doesn't understand sphinx-native param lists
"DOC501", # docstring-missing-exception # Ruff doesn't understand sphinx-native param lists
"EM101", # raw-string-in-exception # FIXME
"EM102", # f-string-in-exception # FIXME
# Ref: https://github.com/astral-sh/ruff/issues/4845#issuecomment-2816845547
"ERA001", # False-positives in commented-out code
"FIX001", # line-contains-fixme # FIXME
"FIX002", # line-contains-todo # FIXME / noqa
"FLY002", # static-join-to-f-string # FIXME
"PLC0414", # useless-import-alias # needed for MyPy explicit re-exports
"PLC0415", # import-outside-top-level # FIXME
"PLC1901", # compare-to-empty-string # FIXME
"PLR0912", # too-many-branches # FIXME
"PLR0913", # too-many-arguments # FIXME / noqa
"PLR0914", # too-many-locals # FIXME / noqa
"PLR0917", # too-many-positional-arguments # FIXME / noqa
"PLR2004", # magic-value-comparison # FIXME
"PLR6301", # no-self-use # FIXME / noqa
"PLW1514", # unspecified-encoding # FIXME
"PTH101", # os-chmod # FIXME
"PTH107", # os-remove # FIXME
"PTH110", # os-path-exists # FIXME
"PTH118", # os-path-join # FIXME
"PTH123", # builtin-open # FIXME
"RET504", # unnecessary-assign # FIXME
"S105", # hardcoded-password-string # FIXME
"S113", # request-without-timeout # FIXME
"SIM117", # multiple-with-statements # FIXME
"TD001", # invalid-todo-tag # FIXME
"TD002", # missing-todo-author # FIXME
"TD003", # missing-todo-link # FIXME
"TD004", # missing-todo-colon # FIXME
"TD005", # missing-todo-description # FIXME
"TRY002", # raise-vanilla-class # FIXME
"TRY003", # raise-vanilla-args # controversial
"TRY201", # verbose-raise # FIXME
"TRY203", # useless-try-except # FIXME
"RUF005", # collection-literal-concatenation # FIXME
"RUF100", # Ruff doesn't know about WPS
"RUF102", # Ruff doesn't know about WPS
]
preview = true # Live dangerously
select = [
"ALL",
]
task-tags = [
"FIXME",
"NOTE",
"Ref",
"Refs",
"TODO",
]
[lint.flake8-pytest-style]
parametrize-values-type = "tuple"
[lint.flake8-tidy-imports.banned-api]
"awx".msg = """
Use `awx_plugins.interfaces._temporary_private_api` instead.
Best design a public API that does not depend on AWX, though.
"""
"django".msg = """
Use `awx_plugins.interfaces._temporary_private_django_api` instead.
Best get rid of the indirect dependency on Django, though.
"""
"unittest".msg = """
Use `pytest` instead. For mocking and spying, inject the `mocker` fixture \
from the already-integrated `pytest-mock` plugin into your tests instead.
`pytest` also has a built-in `monkeypatch` fixture that can be used in \
simple cases or combined with `mocker`.
The existing usage pattern can be found in the existing tests.
"""
[lint.flake8-quotes]
inline-quotes = "single"
[lint.isort]
combine-as-imports = true
force-wrap-aliases = true
lines-after-imports = 2
section-order = [
"future",
"standard-library",
"testing",
"frameworks",
"platforms",
"third-party",
"first-party",
"local-folder",
]
[lint.isort.sections]
frameworks = [
"awx",
"django",
]
platforms = [
"awx_plugins.interfaces",
]
testing = [
"hypothesis",
"pytest",
"pytest_mock",
"pytest_subtests",
]
[lint.per-file-ignores]
"tests/**.py" = [
# The following ignores have been researched and should be considered permanent
# each should be preceded with an explanation of each of the error codes
# If other ignores are added for a specific file in the section following this,
# these will need to be added to that line as well.
"ARG002", # Allow unused arguments in instance methods (required for test stubs)
"PLC2701", # Allow importing internal files needed for testing
"PLR6301", # Allow 'self' parameter in method definitions (required for test stubs)
"S101", # Allow use of `assert` in test files
"S105", # hardcoded-password-string
"S106", # hardcoded-password-func-arg
"S108", # tmp dirs
"S404", # Allow importing 'subprocess' module to testing call external tools needed by these hooks
"S603", # subprocess calls
"SLF001", # Private member accessed
]
"src/awx_plugins/credentials/aim.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN003",
"ANN201",
"D100",
"D103",
"Q003",
]
"src/awx_plugins/credentials/aws_secretsmanager.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN003",
"ANN201",
"D100",
"D103",
]
"src/awx_plugins/credentials/azure_kv.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN003",
"ANN201",
"D100",
"D103",
]
"src/awx_plugins/credentials/centrify_vault.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN003",
"ANN201",
"D100",
"D103",
"N802",
]
"src/awx_plugins/credentials/conjur.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN003",
"ANN201",
"D100",
"D103",
]
"src/awx_plugins/credentials/dsv.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN003",
"ANN201",
"D100",
"D103",
]
"src/awx_plugins/credentials/github_app.py" = [
"S101", # `assert` used for type narrowing
]
"src/awx_plugins/credentials/hashivault.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN003",
"ANN201",
"C901",
"D100",
"D103",
]
"src/awx_plugins/credentials/injectors.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN201",
"ANN202",
"C408",
"D100",
"D103",
]
"src/awx_plugins/credentials/plugin.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN001",
"ANN002",
"ANN201",
"ANN204",
"B010",
"D100",
"D101",
"D103",
"D105",
"D107",
"D205",
"D400",
"E731",
]
"src/awx_plugins/credentials/plugins.py" = [
# The following ignores must be fixed and the entries removed from this config:
"D100",
"D101",
"D103",
"D105",
"D107",
"D205",
"D400",
]
"src/awx_plugins/credentials/tss.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN003",
"ANN201",
"ANN202",
"D100",
"D103",
"E712",
]
"src/awx_plugins/inventory/plugins.py" = [
# The following ignores must be fixed and the entries removed from this config:
"ANN001",
"ANN002",
"ANN003",
"ANN201",
"ANN202",
"ANN206",
"D100",
"D101",
"D102",
"D205",
"D209",
"D400",
"D401",
"N801",
]
"tests/credential_plugins_test.py" = [
# The following ignores must be fixed and the entries removed from this config:
"C419",
"D100",
"D102",
"D103",
"D205",
"D209",
]
"toxfile.py" = [
"FIX002", # line-contains-todo # FIXME / noqa
]
[lint.pydocstyle]
convention = "pep257"