-
Notifications
You must be signed in to change notification settings - Fork 664
/
pyproject.toml
364 lines (333 loc) · 10.7 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
# cspell: ignore FURB
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration and editable installs
"setuptools_scm[toml] >= 7.0.5" # required for "no-local-version" scheme
]
[project]
authors = [{"email" = "[email protected]", "name" = "Will Thames"}]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: POSIX",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python",
"Topic :: System :: Systems Administration",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
"Topic :: Utilities"
]
description = "Checks playbooks for practices and behavior that could potentially be improved"
dynamic = ["version", "dependencies", "optional-dependencies"]
keywords = ["ansible", "lint"]
license = {text = "GPLv3+"}
maintainers = [{"email" = "[email protected]", "name" = "Ansible by Red Hat"}]
name = "ansible-lint"
readme = "README.md"
# https://peps.python.org/pep-0621/#readme
requires-python = ">=3.10"
[project.scripts]
ansible-lint = "ansiblelint.__main__:_run_cli_entrypoint"
[project.urls]
changelog = "https://github.com/ansible/ansible-lint/releases"
documentation = "https://ansible.readthedocs.io/projects/lint/"
homepage = "https://github.com/ansible/ansible-lint"
repository = "https://github.com/ansible/ansible-lint"
[tool.black]
target-version = ["py310"]
[tool.codespell]
# indention is a typo in ruamel.yaml's API
ignore-words-list = "indention"
skip = ".tox,.mypy_cache,build,.git,.eggs,pip-wheel-metadata"
# Keep this default because xml/report do not know to use load it from config file:
# data_file = ".coverage"
[tool.coverage.paths]
source = ["src", ".tox/*/site-packages"]
[tool.coverage.report]
exclude_also = ["pragma: no cover", "if TYPE_CHECKING:"]
# Increase it just so it would pass on any single-python run
fail_under = 92
# During development we might remove code (files) with coverage data, and we dont want to fail:
ignore_errors = true
omit = ["test/*"]
show_missing = true
skip_covered = true
skip_empty = true
[tool.coverage.run]
concurrency = ["multiprocessing", "thread"]
# Do not use branch until bug is fixes:
# https://github.com/nedbat/coveragepy/issues/605
# branch = true
parallel = true
source = ["src"]
[tool.mypy]
check_untyped_defs = true
color_output = true
disallow_any_generics = true
disallow_any_unimported = true
disallow_untyped_calls = true
disallow_untyped_defs = true
error_summary = true
# site-packages is here to help vscode mypy integration getting confused
exclude = "(.config|build|dist|test/local-content|site-packages|~/.pyenv|examples/playbooks/collections|plugins/modules)"
# https://github.com/python/mypy/issues/12664
incremental = false
no_implicit_optional = true
python_version = "3.10"
show_error_code_links = true
show_error_codes = true
strict = true
warn_redundant_casts = true
warn_return_any = true
warn_unused_configs = true
[[tool.mypy.overrides]]
ignore_errors = true
ignore_missing_imports = true
module = [
"ansible.*",
"ansiblelint._version", # generated
"license_expression",
"ruamel.yaml",
"yamllint.*"
]
[tool.pylint.IMPORTS]
preferred-modules = ["py:pathlib", "unittest:pytest"]
[tool.pylint.MASTER]
bad-names = [
# spell-checker:ignore linenumber
"linenumber", # use lineno instead
"line_number" # use lineno instead
]
# pylint defaults + f,fh,v,id
good-names = ["i", "j", "k", "Run", "_", "f", "fh", "v", "id", "T"]
# Ignore as being generated:
ignore-paths = "^(src/ansiblelint/_version|.config/).*$"
[tool.pylint."MESSAGES CONTROL"]
disable = [
# Disabled on purpose:
"line-too-long", # covered by black
"protected-access", # covered by ruff SLF001
"too-many-branches", # covered by ruff C901
"wrong-import-order", # covered by ruff
# TODO(ssbarnea): remove temporary skips adding during initial adoption:
"duplicate-code",
# unable to disable it inside tests
# https://github.com/PyCQA/pylint/issues/850
"cyclic-import",
# https://github.com/PyCQA/pylint/issues/8453
"preferred-module"
]
enable = [
"useless-suppression" # Identify unneeded pylint disable statements
]
# increase from default is 50 which is too aggressive
max-statements = 60
[tool.pylint.REPORTING]
output-format = "colorized"
[tool.pylint.SUMMARY]
# We don't need the score spamming console, as we either pass or fail
score = "n"
[tool.pyright]
exclude = [
".cache",
".config",
".tox",
"ansible_collections",
"build",
"dist",
"site",
"venv"
]
include = ["src"]
mode = "standard"
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#sample-pyprojecttoml-file
# pythonVersion = "3.10"
# reportMissingImports = false
# https://github.com/microsoft/pyright/issues/9494
reportPossiblyUnboundVariable = false
# spell-checker:ignore filterwarnings norecursedirs optionflags
[tool.pytest.ini_options]
# do not add options here as this will likely break either console runs or IDE
# integration like vscode or pycharm
addopts = "-p no:pytest_cov --failed-first"
# https://code.visualstudio.com/docs/python/testing
# coverage is re-enabled in `tox.ini`. That approach is safer than
# `--no-cov` which prevents activation from tox.ini and which also fails
# when plugin is effectively missing.
doctest_optionflags = ["ALLOW_UNICODE", "ELLIPSIS"]
filterwarnings = [
"error",
# https://sourceforge.net/p/ruamel-yaml/tickets/452/
"ignore:Deprecated call to `pkg_resources.declare_namespace:DeprecationWarning",
# https://github.com/spdx/tools-python/issues/507
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
# We raise one non critical warning from our own conftest.py:
"always::pytest.PytestWarning",
# py312 ansible-core
# https://github.com/ansible/ansible/issues/81906
"ignore:'importlib.abc.TraversableResources' is deprecated and slated for removal in Python 3.14:DeprecationWarning",
# https://github.com/ansible/ansible/pull/80968
"ignore:Attribute s is deprecated and will be removed in Python 3.14; use value instead:DeprecationWarning"
]
junit_duration_report = "call"
# Our github annotation parser from .github/workflows/tox.yml requires xunit1 format. Ref:
# https://github.com/shyim/junit-report-annotations-action/issues/3#issuecomment-663241378
junit_family = "xunit1"
junit_suite_name = "ansible_lint_test_suite"
minversion = "4.6.6"
norecursedirs = [
"*.egg",
".cache",
".config",
".eggs",
".git",
".github",
".mypy_cache",
".projects",
".tox",
"build",
"collections",
"dist",
"docs",
"src/ansible_lint.egg-info"
]
python_files = [
"test_*.py",
# Ref: https://docs.pytest.org/en/latest/reference.html#confval-python_files
# Needed to discover legacy nose test modules:
"Test*.py",
# Needed to discover embedded Rule tests
"rules/*.py"
]
# Using --pyargs instead of testpath as we embed some tests
# See: https://github.com/pytest-dev/pytest/issues/6451#issuecomment-687043537
# testpaths =
xfail_strict = true
[tool.ruff]
cache-dir = "./.cache/.ruff"
exclude = [".config"]
fix = true
# Same as Black.
line-length = 88
preview = true
target-version = "py310"
[tool.ruff.lint]
ignore = [
"COM812", # conflicts with ISC001 on format
"CPY001", # missing-copyright-notice
"D203", # incompatible with D211
"D213", # incompatible with D212
"E501", # we use black
"ERA001", # auto-removal of commented out code affects development and vscode integration
"INP001", # "is part of an implicit namespace package", all false positives
"ISC001", # conflicts with COM812 on format
"PLW2901", # PLW2901: Redefined loop variable
"RET504", # Unnecessary variable assignment before `return` statement
# temporary disabled until we fix them:
"ANN",
"ARG002", # Unused method argument (currently in too many places)
"D102", # Missing docstring in public method (currently in too many places)
"FBT001",
"FBT003",
"PLR",
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"PERF203",
"PD011", # We are not using pandas, any .values attributes are unrelated
"PLW0603", # global lock file in cache dir
# part of preview rules:
"B909", # raise-missing-from
"DOC201", # docstring-missing-returns
"DOC402", # docstring-missing-summary
"DOC501", # docstring-missing-exception
"FURB101",
"FURB103",
"FURB110",
"FURB113",
"FURB118",
"PLC0415",
"PLC2701",
"PLW1641",
"S404"
]
select = ["ALL"]
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["id"]
[tool.ruff.lint.flake8-pytest-style]
parametrize-values-type = "tuple"
[tool.ruff.lint.isort]
known-first-party = ["src"]
[tool.ruff.lint.mccabe]
# Implicit 10 is too low for our codebase, even black uses 18 as default.
max-complexity = 20
[tool.ruff.lint.per-file-ignores]
"src/ansiblelint/rules/*.py" = ["S"]
"src/ansiblelint/testing/*.py" = ["S"]
# Temporary disabled until we fix them:
"src/ansiblelint/{utils,file_utils,runner,loaders,constants,config,cli,_mockings}.py" = [
"PTH"
]
"test/**/*.py" = ["DOC201", "DOC501", "PLC2701", "S"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.setuptools.dynamic]
dependencies = {file = [".config/requirements.in"]}
optional-dependencies.docs = {file = [".config/requirements-docs.in"]}
optional-dependencies.test = {file = [".config/requirements-test.in"]}
[tool.setuptools_scm]
# To prevent accidental pick of mobile version tags such 'v6'
git_describe_command = [
"git",
"describe",
"--dirty",
"--long",
"--tags",
"--match",
"v*.*"
]
local_scheme = "no-local-version"
tag_regex = "^(?P<prefix>v)?(?P<version>[0-9.]+)(?P<suffix>.*)?$"
write_to = "src/ansiblelint/_version.py"
[tool.tomlsort]
in_place = true
sort_inline_tables = true
sort_table_keys = true
[tool.uv.pip]
annotation-style = "line"
custom-compile-command = "tox run deps"
no-emit-package = ["ansible-core", "pip", "resolvelib", "typing_extensions", "uv"]
[tool.vulture]
exclude = [
".eggs",
".tox",
"build",
"collections",
"examples",
"plugins",
"test/local-content",
"venv",
"src/ansiblelint/_version.py"
]
ignore_names = [
"_ANSIBLE_ARGS",
"__line__",
"__rich_console__",
"fixture_*",
"pytest_addoption",
"pytest_collection_modifyitems",
"pytest_configure",
"side_effect",
"test_*"
]
paths = ["src", "test", ".config/vulture_whitelist.py"]