From ba233a0cbad76b4783a03893e7bf4716fbc0f0ec Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 26 Jun 2024 08:24:58 +0200 Subject: Merging upstream version 24.6.1. Signed-off-by: Daniel Baumann --- pyproject.toml | 133 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 78 insertions(+), 55 deletions(-) (limited to 'pyproject.toml') diff --git a/pyproject.toml b/pyproject.toml index e182c5b..b1ff701 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,13 +2,12 @@ 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 - ] build-backend = "setuptools.build_meta" [project] # https://peps.python.org/pep-0621/#readme -requires-python = ">=3.9" +requires-python = ">=3.10" dynamic = ["version", "dependencies", "optional-dependencies"] name = "ansible-lint" description = "Checks playbooks for practices and behavior that could potentially be improved" @@ -27,9 +26,9 @@ classifiers = [ "Operating System :: POSIX", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python", "Topic :: System :: Systems Administration", @@ -39,47 +38,47 @@ classifiers = [ ] keywords = ["ansible", "lint"] +[project.scripts] +ansible-lint = "ansiblelint.__main__:_run_cli_entrypoint" + [project.urls] homepage = "https://github.com/ansible/ansible-lint" -documentation = "https://ansible-lint.readthedocs.io/" +documentation = "https://ansible.readthedocs.io/projects/lint/" repository = "https://github.com/ansible/ansible-lint" changelog = "https://github.com/ansible/ansible-lint/releases" -[project.scripts] -ansible-lint = "ansiblelint.__main__:_run_cli_entrypoint" - [tool.black] -target-version = ["py39"] +target-version = ["py310"] [tool.codespell] skip = ".tox,.mypy_cache,build,.git,.eggs,pip-wheel-metadata" # indention is a typo in ruamel.yaml's API ignore-words-list = "indention" -[tool.coverage.run] -source = ["src"] -# Do not use branch until bug is fixes: -# https://github.com/nedbat/coveragepy/issues/605 -# branch = true -parallel = true -concurrency = ["multiprocessing", "thread"] - # 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_lines = ["pragma: no cover", "if TYPE_CHECKING:"] +exclude_also = ["pragma: no cover", "if TYPE_CHECKING:"] omit = ["test/*"] # Increase it just so it would pass on any single-python run -fail_under = 93 +fail_under = 92 skip_covered = true skip_empty = true # During development we might remove code (files) with coverage data, and we dont want to fail: ignore_errors = true show_missing = true +[tool.coverage.run] +source = ["src"] +# Do not use branch until bug is fixes: +# https://github.com/nedbat/coveragepy/issues/605 +# branch = true +parallel = true +concurrency = ["multiprocessing", "thread"] + [tool.isort] profile = "black" # add_imports = "from __future__ import annotations" @@ -94,7 +93,7 @@ ensure_newline_before_comments = true line_length = 88 [tool.mypy] -python_version = 3.9 +python_version = "3.10" strict = true color_output = true error_summary = true @@ -108,31 +107,30 @@ disallow_any_generics = true # site-packages is here to help vscode mypy integration getting confused exclude = "(build|dist|test/local-content|site-packages|~/.pyenv|examples/playbooks/collections|plugins/modules)" # https://github.com/python/mypy/issues/12664 -no_incremental = true +incremental = false [[tool.mypy.overrides]] module = [ "ansible.*", - "yamllint.*", "ansiblelint._version", # generated + "license_expression", "ruamel.yaml", - "spdx.*", + "yamllint.*", ] ignore_missing_imports = true ignore_errors = true -[tool.pylint.MAIN] -extension-pkg-allow-list = ["black.parsing"] - [tool.pylint.IMPORTS] preferred-modules = ["py:pathlib", "unittest:pytest"] +[tool.pylint.MAIN] +extension-pkg-allow-list = ["black.parsing"] + [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"] @@ -145,6 +143,7 @@ max-statements = 60 disable = [ # Disabled on purpose: "line-too-long", # covered by black + "protected-access", # covered by ruff SLF001 "too-many-branches", # covered by ruff C901 # TODO(ssbarnea): remove temporary skips adding during initial adoption: "duplicate-code", @@ -154,10 +153,12 @@ disable = [ # https://github.com/PyCQA/pylint/issues/8453 "preferred-module", ] +enable = [ + "useless-suppression", # Identify unneeded pylint disable statements +] -[tool.pylint.TYPECHECK] -# pylint is unable to detect Namespace attributes and will throw a E1101 -generated-members = "options.*" +[tool.pylint.REPORTING] +output-format = "colorized" [tool.pylint.SUMMARY] # We don't need the score spamming console, as we either pass or fail @@ -165,7 +166,7 @@ score = "n" [tool.pyright] # https://github.com/microsoft/pyright/blob/main/docs/configuration.md#sample-pyprojecttoml-file -pythonVersion = "3.9" +pythonVersion = "3.10" include = ["src"] # https://github.com/microsoft/pyright/issues/777 "stubPath" = "" @@ -188,6 +189,11 @@ filterwarnings = [ "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: @@ -196,18 +202,19 @@ junit_family = "xunit1" junit_suite_name = "ansible_lint_test_suite" minversion = "4.6.6" norecursedirs = [ - "build", - "collections", - "dist", - "docs", - "src/ansible_lint.egg-info", + "*.egg", ".cache", ".eggs", ".git", ".github", - ".tox", - "*.egg", + ".mypy_cache", ".projects", + ".tox", + "build", + "collections", + "dist", + "docs", + "src/ansible_lint.egg-info", ] python_files = [ "test_*.py", @@ -223,8 +230,12 @@ python_files = [ xfail_strict = true [tool.ruff] -required-version = "0.0.274" -ignore = [ +target-version = "py310" +# Same as Black. +line-length = 88 +lint.ignore = [ + "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 @@ -238,27 +249,26 @@ ignore = [ "FBT003", "PLR", "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` - "TRY", + "PERF203", + "PD011", # We are not using pandas, any .values attributes are unrelated + "PLW0603", # global lock file in cache dir ] -select = ["ALL"] -target-version = "py39" -# Same as Black. -line-length = 88 - -[tool.ruff.mccabe] -# Implicit 10 is too low for our codebase, even black uses 18 as default. -max-complexity = 20 +lint.select = ["ALL"] -[tool.ruff.flake8-builtins] +[tool.ruff.lint.flake8-builtins] builtins-ignorelist = ["id"] -[tool.ruff.flake8-pytest-style] +[tool.ruff.lint.flake8-pytest-style] parametrize-values-type = "tuple" -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["ansiblelint"] -[tool.ruff.per-file-ignores] +[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] "test/**/*.py" = ["S"] "src/ansiblelint/rules/*.py" = ["S"] "src/ansiblelint/testing/*.py" = ["S"] @@ -267,12 +277,25 @@ known-first-party = ["ansiblelint"] "PTH", ] +[tool.ruff.lint.pydocstyle] +convention = "google" + [tool.setuptools.dynamic] -optional-dependencies.docs = { file = [".config/requirements-docs.txt"] } -optional-dependencies.test = { file = [".config/requirements-test.txt"] } -optional-dependencies.lock = { file = [".config/requirements-lock.txt"] } dependencies = { file = [".config/requirements.in"] } +optional-dependencies.docs = { file = [".config/requirements-docs.in"] } +optional-dependencies.test = { file = [".config/requirements-test.in"] } [tool.setuptools_scm] local_scheme = "no-local-version" +tag_regex = "^(?Pv)?(?P[0-9.]+)(?P.*)?$" write_to = "src/ansiblelint/_version.py" +# To prevent accidental pick of mobile version tags such 'v6' +git_describe_command = [ + "git", + "describe", + "--dirty", + "--tags", + "--long", + "--match", + "v*.*", +] -- cgit v1.2.3