forked from ansible/ansible-navigator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
413 lines (388 loc) · 18.9 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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
[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 :: 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"]
data_file = ".tox/.coverage"
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]
allow-init-docstring = true
arg-type-hints-in-docstring = false
check-return-types = false
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-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
]
[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 = [
'ANN001', # Missing type annotation for function argument `output`
'ANN002', # Missing type annotation for `*args`
'ANN003', # Missing type annotation for `**kwargs`
'ANN101', # Missing type annotation for `self` in method
'ANN102', # Missing type annotation for `cls` in classmethod
'ANN201', # Missing return type annotation for public function `notify_none`
'ANN202', # Missing return type annotation for private function `_build_main_menu`
'ANN204', # [*] Missing return type annotation for special method `__init__`
'ANN205', # Missing return type annotation for staticmethod `run_single_process`
'ANN206', # Missing return type annotation for classmethod `_missing_`
'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`
'B005', # Using `.strip()` with multi-character strings is misleading the reader
'B006', # Do not use mutable data structures for argument defaults
'B010', # [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
'B018', # Found useless attribute access. Either assign it to a variable or remove it.
'B019', # Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
'B028', # No explicit `stacklevel` keyword argument found
'C408', # [*] Unnecessary `tuple` call (rewrite as a literal)
'C409', # [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal)
'C414', # [*] Unnecessary `list` call within `sorted()`
'C901', # `_params_row_for_entry` is too complex (11 > 10)
'COM812', # [*] Trailing comma missing
'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
'D400', # [*] First line should end with a period
'D403', # [*] First word of the first line should be capitalized: `tokenize` -> `Tokenize`
'E501', # line-too-long, already covered by black
'ERA001', # [*] Found commented-out code
'FBT001', # Boolean positional arg in function definition
'FBT002', # Boolean default value in function definition
'FBT003', # Boolean positional value in function call
'FIX001', # Line contains FIXME
'FIX002', # Line contains TODO
'INP001', # File `docs/_ext/regenerate_docs.py` is part of an implicit namespace package. Add an `__init__.py`.
'N802', # Function name `formatTime` should be lowercase
'N806', # Variable `FType` in function should be lowercase
'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
'PIE810', # [*] Call `startswith` once with a `tuple`
'PD011', # https://github.com/astral-sh/ruff/issues/2229
'PLC1901', # `self.fs_source == ""` can be simplified to `not self.fs_source` as an empty string is falsey
'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
'PLR5501', # Consider using `elif` instead of `else` then `if` to remove one indentation level
'PLW0120', # `else` clause on loop without a `break` statement; remove the `else` and de-indent all the code inside it
'PLW0603', # Using the global statement to update `DIAGNOSTIC_FAILURES` is discouraged
'PLW2901', # `for` loop variable `info_name` overwritten by assignment target
'PT001', # [*] Use `@pytest.fixture()` over `@pytest.fixture`
'PT003', # [*] `scope='function'` is implied in `@pytest.fixture()`
'PT004', # Fixture `patch_curses` does not return anything, add leading underscore
'PT005', # Fixture `_settings_samples` returns a value, remove leading underscore
'PT006', # [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
'PT007', # Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple`
'PT009', # [*] Use a regular `assert` instead of unittest-style `assertIn`
'PT011', # `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception
'PT012', # `pytest.raises()` block should contain a single simple statement
'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`
'PTH100', # `os.path.abspath()` should be replaced by `Path.resolve()`
'PTH101', # `os.chmod()` should be replaced by `Path.chmod()`
'PTH103', # `os.makedirs()` should be replaced by `Path.mkdir(parents=True)`
'PTH107', # `os.remove()` should be replaced by `Path.unlink()`
'PTH109', # `os.getcwd()` should be replaced by `Path.cwd()`
'PTH110', # `os.path.exists()` should be replaced by `Path.exists()`
'PTH111', # `os.path.expanduser()` should be replaced by `Path.expanduser()`
'PTH112', # `os.path.isdir()` should be replaced by `Path.is_dir()`
'PTH113', # `os.path.isfile()` should be replaced by `Path.is_file()`
'PTH114', # `os.path.islink()` should be replaced by `Path.is_symlink()`
'PTH115', # `os.readlink()` should be replaced by `Path.readlink()`
'PTH116', # `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()`
'PTH118', # `os.path.join()` should be replaced by `Path` with `/` operator
'PTH119', # `os.path.basename()` should be replaced by `Path.name`
'PTH120', # `os.path.dirname()` should be replaced by `Path.parent`
'PTH122', # `os.path.splitext()` should be replaced by `Path.suffix`
'PTH123', # `open()` should be replaced by `Path.open()`
'PTH204', # `os.path.getmtime` should be replaced by `Path.stat().st_mtime`
'PTH207', # Replace `glob` with `Path.glob` or `Path.rglob`
'PYI021', # Docstrings should not be included in stubs
'PYI024', # Use `typing.NamedTuple` instead of `collections.namedtuple`
'PYI034', # `__enter__` methods in classes like `TmuxSession` usually return `self` at runtime
'PYI036', # The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None`
'PYI041', # Use `float` instead of `int | float`
'RET501', # [*] Do not explicitly `return None` in function if it is the only possible return value
'RET503', # [*] Missing explicit `return` at the end of function able to return non-`None` value
'RET504', # Unnecessary variable assignment before `return` statement
'RET505', # Unnecessary `else` after `return` statement
'RUF005', # [*] Consider `[self._name, *shlex.split(self._interaction.action.match.groupdict()["params"] or "")]` instead of concatenation
'RUF009', # Do not perform function call `PresentableCliParameters` in dataclass defaults
'RUF012', # Mutable class attributes should be annotated with `typing.ClassVar`
'RUF100', # [*] Unused `noqa` directive (unused: `E731`)
'S101', # Use of `assert` detected
'S103', # `os.chmod` setting a permissive mask `0o777` on file or directory
'S108', # Probable insecure usage of temporary file or directory: "/tmp"
'S110', # `try`-`except`-`pass` detected, consider logging the exception
'S311', # Standard pseudo-random generators are not suitable for cryptographic purposes
'S602', # `subprocess` call with `shell=True` identified, security issue
'S603', # `subprocess` call: check for execution of untrusted input
'S605', # Starting a process with a shell, possible injection detected
'S607', # Starting a process with a partial executable path
'SLF001', # Private member accessed: `_ui`
'T201', # `print` found
'TCH001', # Move application import `ansible_navigator.configuration_subsystem.definitions.SettingsEntry` into a type-checking block
'TCH002', # Move third-party import `ansible_runner.Runner` into a type-checking block
'TCH003', # Move standard library import `re.Pattern` into a type-checking block
'TD001', # Invalid TODO tag: `FIXME`
'TD002', # Missing author in TODO
'TD003', # Missing issue link on the line following this TODO
'TRY003', # Avoid specifying long messages outside the exception class
'TRY004', # Prefer `TypeError` exception for invalid type
'TRY300', # Consider moving this statement to an `else` block
'TRY301', # Abstract `raise` to an inner function
'TRY400', # Use `logging.exception` instead of `logging.error`
'TRY401' # Redundant exception object included in `logging.exception` call
]
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.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"