-
Notifications
You must be signed in to change notification settings - Fork 102
/
pyproject.toml
336 lines (310 loc) · 13.1 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
[build-system]
build-backend = "setuptools.build_meta"
requires = [
# Essentials
"setuptools >= 45",
# Plugins
"setuptools_scm[toml] >= 7.0"
]
[project]
requires-python = ">=3.10"
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Topic :: Software Development :: Testing',
'Topic :: Software Development :: Quality Assurance',
'Topic :: Utilities',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
"Programming Language :: Python :: 3.13",
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy'
]
dynamic = ["version", "dependencies", "optional-dependencies"]
name = "ansible-navigator"
description = "A text-based user interface (TUI) for the Red Hat Ansible Automation Platform"
readme = "README.md"
authors = [{"name" = "Bradley A. Thornton", "email" = "bthornto@redhat.com"}]
maintainers = [{"name" = "Ansible by Red Hat", "email" = "info@ansible.com"}]
license = {text = "Apache"}
keywords = ["ansible"]
[project.scripts]
ansible-navigator = "ansible_navigator.cli:main"
[project.urls]
homepage = "https://github.com/ansible/ansible-navigator"
documentation = "https://ansible-navigator.readthedocs.io/en/latest/"
repository = "https://github.com/ansible/ansible-navigator"
changelog = "https://github.com/ansible/ansible-navigator/releases"
[tool]
[tool.black]
line-length = 100
[tool.coverage.paths]
source = ["src", ".tox/*/site-packages"]
[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]
skip_covered = true
show_missing = true
[tool.coverage.run]
# branch = true
concurrency = ["multiprocessing", "thread"]
parallel = true
source_pkgs = ["ansible_navigator"]
[tool.mypy]
python_version = "3.10"
# strict = true
color_output = true
error_summary = true
check_untyped_defs = true
# disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_any_generics = true
incremental = false
[[tool.mypy.overrides]]
# https://github.com/ansible/ansible-runner/issues/1340
module = ["ansible_runner"]
ignore_missing_imports = true
[tool.pydoclint]
arg-type-hints-in-docstring = false
baseline = ".config/pylint-baseline.txt"
exclude = '\.git|\.test_logs|\.tox|build|out|tests/fixtures|venv'
style = 'google'
[tool.pylint]
[tool.pylint.format]
max-line-length = 100
[tool.pylint.imports]
preferred-modules = [
# NOTE: The unittest replacements below help keep
# NOTE: the tests pytest ecosystem-oriented.
"unittest:pytest",
"unittest.mock:pytest-mock"
]
[tool.pylint.master]
ignore = [
"_version.py", # built by setuptools_scm
"tm_tokenize" # tm_tokenize is virtually vendored and shouldn't be linted as such
]
# pylint defaults + fh for with open .. as (f|fh)
good-names = "i,j,k,ex,Run,_,f,fh"
jobs = 0
no-docstring-rgx = "__.*__"
max-positional-arguments = 14
max-args = 6 # default of 5 too low
[tool.pylint.messages_control]
disable = [
"duplicate-code",
"fixme",
"too-few-public-methods",
"unsubscriptable-object",
# https://gist.github.com/cidrblock/ec3412bacfeb34dbc2d334c1d53bef83
"C0103", # invalid-name / ruff N815
"C0112", # empty-docstring / ruff D419
"C0114", # missing-module-docstring / ruff D100
"C0115", # missing-class-docstring / ruff D101
"C0116", # missing-function-docstring / ruff D103
"C0121", # singleton-comparison / ruff PLC0121
"C0123", # unidiomatic-typecheck / ruff E721
# "C0198", # bad-docstring-quotes / ruff Q002
# "C0199", # docstring-first-line-empty / ruff D210
"C0202", # bad-classmethod-argument / ruff PLC0202
"C0301", # line-too-long / ruff E501
"C0304", # missing-final-newline / ruff W292
"C0325", # superfluous-parens / ruff UP034
"C0410", # multiple-imports / ruff E401
"C0411", # wrong-import-order / ruff I001
"C0412", # ungrouped-imports / ruff I001
"C0413", # wrong-import-position / ruff E402
"C0414", # useless-import-alias / ruff PLC0414
# "C0501", # consider-using-any-or-all / ruff PLC0501
# "C2201", # misplaced-comparison-constant / ruff SIM300
"C3001", # unnecessary-lambda-assignment / ruff PLC3001
"C3002", # unnecessary-direct-lambda-call / ruff PLC3002
"E0001", # syntax-error / ruff E999
"E0101", # return-in-init / ruff PLE0101
"E0102", # function-redefined / ruff F811
"E0103", # not-in-loop / ruff PLE0103
"E0104", # return-outside-function / ruff F706
"E0105", # yield-outside-function / ruff F704
"E0107", # nonexistent-operator / ruff B002
"E0116", # continue-in-finally / ruff PLE0116
"E0117", # nonlocal-without-binding / ruff PLE0117
"E0118", # used-prior-global-declaration / ruff PLE0118
"E0211", # no-method-argument / ruff N805
"E0213", # no-self-argument / ruff N805
"E0602", # undefined-variable / ruff F821
"E0604", # invalid-all-object / ruff PLE0604
"E0605", # invalid-all-format / ruff PLE0605
"E0711", # notimplemented-raised / ruff F901
"E1133", # not-an-iterable
"E1142", # await-outside-async / ruff PLE1142
"E1205", # logging-too-many-args / ruff PLE1205
"E1206", # logging-too-few-args / ruff PLE1206
"E1301", # truncated-format-string / ruff F501
"E1302", # mixed-format-string / ruff F506
"E1303", # format-needs-mapping / ruff F502
"E1304", # missing-format-string-key / ruff F524
"E1307", # bad-string-format-type / ruff PLE1307
"E1310", # bad-str-strip-call / ruff PLE1310
"E2502", # bidirectional-unicode / ruff PLE2502
"E2510", # invalid-character-backspace / ruff PLE2510
"E2512", # invalid-character-sub / ruff PLE2512
"E2513", # invalid-character-esc / ruff PLE2513
"E2514", # invalid-character-nul / ruff PLE2514
"E2515", # invalid-character-zero-width-space / ruff PLE2515
"R0123", # literal-comparison / ruff F632
"R0133", # comparison-of-constants / ruff PLR0133
"R0205", # useless-object-inheritance / ruff UP004
"R0911", # too-many-return-statements / ruff PLR0911
"R0912", # too-many-branches / ruff PLR0912
"R0915", # too-many-statements / ruff PLR0915
# "R1260", # too-complex / ruff C901
"R1701", # consider-merging-isinstance / ruff PLR1701
"R1706", # consider-using-ternary / ruff SIM108
"R1707", # trailing-comma-tuple / ruff COM818
"R1710", # inconsistent-return-statements / ruff PLR1710
"R1711", # useless-return / ruff PLR1711
"R1715", # consider-using-get / ruff SIM401
"R1717", # consider-using-dict-comprehension / ruff C402
"R1718", # consider-using-set-comprehension / ruff C401
"R1721", # unnecessary-comprehension / ruff PLR1721
"R1722", # consider-using-sys-exit / ruff PLR1722
"R1725", # super-with-arguments / ruff UP008
"R1728", # consider-using-generator / ruff C417
"R1729", # use-a-generator / ruff C417
"R1734", # use-list-literal / ruff C405
"R1735", # use-dict-literal / ruff C406
# "R2004", # magic-value-comparison / ruff PLR2004
# "R5501", # else-if-used / ruff PLR5501
# "R6002", # consider-using-alias / ruff UP006
# "R6003", # consider-alternative-union-syntax / ruff UP007
"W0102", # dangerous-default-value / ruff B006
"W0104", # pointless-statement / ruff B018
"W0106", # expression-not-assigned / ruff B018
"W0109", # duplicate-key / ruff F601
"W0120", # useless-else-on-loop / ruff PLW0120
"W0129", # assert-on-string-literal / ruff PLW0129
# "W0160", # consider-ternary-expression / ruff SIM108
"W0199", # assert-on-tuple / ruff F631
"W0401", # wildcard-import / ruff F403
"W0406", # import-self / ruff PLW0406
"W0410", # misplaced-future / ruff F404
"W0602", # global-variable-not-assigned / ruff PLW0602
"W0603", # global-statement / ruff PLW0603
"W0611", # unused-import / ruff F401
"W0612", # unused-variable / ruff F841
"W0613", # unused-argument / ruff ARG001
"W0622", # redefined-builtin / ruff A001
"W0640", # cell-var-from-loop / ruff B023
"W0702", # bare-except / ruff E722
"W0705", # duplicate-except / ruff B014
"W0711", # binary-op-exception / ruff PLW0711
"W0718", # broad-exception-caught / ruff PLW0718
"W1300", # bad-format-string-key / ruff PLW1300
"W1301", # unused-format-string-key / ruff F504
"W1302", # bad-format-string / ruff PLW1302
"W1304", # unused-format-string-argument / ruff F507
"W1308", # duplicate-string-formatting-argument / ruff PLW1308
"W1309", # f-string-without-interpolation / ruff F541
"W1310", # format-string-without-interpolation / ruff PLW1310
"W1401", # anomalous-backslash-in-string / ruff W605
"W1405", # inconsistent-quotes / ruff Q000
"W1508", # invalid-envvar-default / ruff PLW1508
"W1515" # forgotten-debug-statement / ruff T100
]
enable = [
"useless-suppression" # Identify unneeded pylint disable statements
]
fail-on = [
"useless-suppression"
]
[tool.pytest.ini_options]
# do not add xdist options here as this will make running of a single test and
# debugging hard.
addopts = "--maxfail=10 --durations=30 --showlocals"
filterwarnings = [
"error",
# https://github.com/ansible/ansible-runner/issues/1246
"ignore::ResourceWarning:ansible_runner",
"ignore::pytest.PytestUnraisableExceptionWarning",
"ignore::DeprecationWarning:ansible_runner"
]
[tool.pytest_env]
PYTEST_CHECK_TEST_DUPLICATE = 0
PYTEST_CHECK_TEST_ID_REGEX = 1
PYTEST_MAX_TEST_ID_LENGTH = 0
[tool.ruff]
fix = true
line-length = 100
builtins = ["__"]
exclude = ["tests/fixtures/**", ".git"]
[tool.ruff.lint]
ignore = [
'ANN101', # This rule is deprecated and will be removed in a future release.
'ANN102', # This rule is deprecated and will be removed in a future release.
'ERA001', # [*] Found commented-out code
'INP001', # File `docs/_ext/regenerate_docs.py` is part of an implicit namespace package. Add an `__init__.py`.
'PLW2901', # `for` loop variable `info_name` overwritten by assignment target
"RET504", # Unnecessary variable assignment before `return` statement
# temporary disabled until we fix them:
'ANN401', # Dynamically typed expressions (typing.Any) are disallowed in `cls`
'ARG001', # Unused function argument: `colno`
'ARG002', # Unused method argument: `app`
'ARG003', # Unused class method argument: `value`
'ARG004', # Unused static method argument: `config`
'ARG005', # Unused lambda argument: `args`
'B006', # Do not use mutable data structures for argument defaults
'C901', # `_params_row_for_entry` is too complex (11 > 10)
'D100', # Missing docstring in public module
'D101', # Missing docstring in public class
'D102', # Missing docstring in public method
'D103', # Missing docstring in public function
'FBT001', # Boolean positional arg in function definition
'FBT002', # Boolean default value in function definition
'FBT003', # Boolean positional value in function call
'N812', # Lowercase `__version_collection_doc_cache__` imported as non-lowercase `VERSION_CDC`
'N813', # Camelcase `Action` imported as lowercase `stdout_action`
'N817', # CamelCase `Constants` imported as acronym `C`
'PERF203', # `try`-`except` within a loop incurs performance overhead
'PGH003', # Use specific rule codes when ignoring type issues
'PD011', # https://github.com/astral-sh/ruff/issues/2229
'PLR0911', # Too many return statements (8 > 6)
'PLR0912', # Too many branches (13 > 12)
'PLR0913', # Too many arguments to function call (7 > 5)
'PLR0915', # Too many statements (58 > 50)
'PLR2004', # Magic value used in comparison, consider replacing 2 with a constant variable
'PLW0603', # Using the global statement to update `DIAGNOSTIC_FAILURES` is discouraged
'PT005', # Fixture `_settings_samples` returns a value, remove leading underscore
'PT019', # Fixture `_mocked_func` without value is injected as parameter, use `@pytest.mark.usefixtures` instead
'PT022', # [*] No teardown in fixture `cmd_in_tty`, use `return` instead of `yield`
'RET505', # Unnecessary `else` after `return` statement
'RUF005', # [*] Consider `[self._name, *shlex.split(self._interaction.action.match.groupdict()["params"] or "")]` instead of concatenation
'RUF012', # Mutable class attributes should be annotated with `typing.ClassVar`
'S108', # Probable insecure usage of temporary file or directory: "/tmp"
'S602', # `subprocess` call with `shell=True` identified, security issue
'S603', # `subprocess` call: check for execution of untrusted input
'T201' # `print` found
]
select = ["ALL"]
[tool.ruff.lint.flake8-pytest-style]
parametrize-values-type = "tuple"
[tool.ruff.lint.isort]
force-single-line = true # Force from .. import to be 1 per line
known-first-party = ["ansible_navigator"]
lines-after-imports = 2 # Ensures consistency for cases when there's variable vs function/class definitions after imports
lines-between-types = 1 # Separate import/from with 1 line
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["SLF001", "S101", "S602"]
[tool.ruff.lint.pydocstyle]
convention = "pep257"
[tool.setuptools.dynamic]
dependencies = {file = [".config/requirements.in"]}
optional-dependencies.test = {file = [".config/requirements-test.in"]}
optional-dependencies.docs = {file = [".config/requirements-docs.in"]}
[tool.setuptools_scm]
local_scheme = "no-local-version"
write_to = "src/ansible_navigator/_version.py"