From 75509b8b7e8d8de3ba491461f5f229411558818b Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 16 Aug 2023 16:52:29 +0100 Subject: [PATCH] Update test dependencies (#3652) --- .config/requirements-lock.txt | 30 ++++++++++++------------ .config/requirements.txt | 38 +++++++++++++++---------------- .github/dependabot.yml | 6 +++++ .pre-commit-config.yaml | 14 ++++++------ pyproject.toml | 2 +- src/ansiblelint/loaders.py | 13 ++++++++--- src/ansiblelint/rules/__init__.py | 2 +- src/ansiblelint/rules/jinja.py | 12 +++++++--- test/schemas/package-lock.json | 14 ++++++------ test/schemas/package.json | 2 +- test/test_matcherrror.py | 9 +++----- tox.ini | 1 + 12 files changed, 80 insertions(+), 63 deletions(-) diff --git a/.config/requirements-lock.txt b/.config/requirements-lock.txt index 129c952f42..5876fb0a2f 100644 --- a/.config/requirements-lock.txt +++ b/.config/requirements-lock.txt @@ -2,43 +2,43 @@ # This file is autogenerated by pip-compile with Python 3.9 # by the following command: # -# pip-compile --no-annotate --output-file=.config/requirements-lock.txt --resolver=backtracking --strip-extras --unsafe-package=resolvelib --unsafe-package=ruamel-yaml-clib pyproject.toml +# pip-compile --no-annotate --output-file=.config/requirements-lock.txt --strip-extras --unsafe-package=resolvelib --unsafe-package=ruamel-yaml-clib pyproject.toml # ansible-compat==4.1.6 -ansible-core==2.15.1 +ansible-core==2.15.3 attrs==23.1.0 black==23.7.0 bracex==2.3.post1 -certifi==2023.5.7 +certifi==2023.7.22 cffi==1.15.1 charset-normalizer==3.2.0 -click==8.1.5 -cryptography==41.0.2 +click==8.1.6 +cryptography==41.0.3 filelock==3.12.2 idna==3.4 importlib-resources==5.0.7 jinja2==3.1.2 -jsonschema==4.18.3 -jsonschema-specifications==2023.6.1 +jsonschema==4.19.0 +jsonschema-specifications==2023.7.1 markdown-it-py==3.0.0 markupsafe==2.1.3 mdurl==0.1.2 mypy-extensions==1.0.0 packaging==23.1 -pathspec==0.11.1 -platformdirs==3.9.1 +pathspec==0.11.2 +platformdirs==3.10.0 pycparser==2.21 -pygments==2.15.1 -pyyaml==6.0 -referencing==0.29.1 +pygments==2.16.1 +pyyaml==6.0.1 +referencing==0.30.2 requests==2.31.0 -rich==13.4.2 -rpds-py==0.8.10 +rich==13.5.2 +rpds-py==0.9.2 ruamel-yaml==0.17.32 subprocess-tee==0.4.1 tomli==2.0.1 typing-extensions==4.7.1 -urllib3==2.0.3 +urllib3==2.0.4 wcmatch==8.4.1 yamllint==1.32.0 diff --git a/.config/requirements.txt b/.config/requirements.txt index 34fe042513..47145fbd8a 100644 --- a/.config/requirements.txt +++ b/.config/requirements.txt @@ -5,7 +5,7 @@ # pip-compile --extra=docs --extra=test --no-annotate --output-file=.config/requirements.txt --strip-extras --unsafe-package=resolvelib --unsafe-package=ruamel-yaml-clib pyproject.toml # ansible-compat==4.1.6 -ansible-core==2.15.1 +ansible-core==2.15.3 astroid==2.15.6 attrs==23.1.0 beautifulsoup4==4.12.2 @@ -18,14 +18,14 @@ cffi==1.15.1 charset-normalizer==3.1.0 click==8.1.3 colorama==0.4.6 -coverage==7.2.7 +coverage==7.3.0 coverage-enable-subprocess==1.0 -cryptography==41.0.2 +cryptography==41.0.3 csscompressor==0.9.5 cssselect2==0.7.0 defusedxml==0.7.1 -dill==0.3.6 -exceptiongroup==1.1.2 +dill==0.3.7 +exceptiongroup==1.1.3 execnet==2.0.2 filelock==3.12.2 ghp-import==2.1.0 @@ -40,8 +40,8 @@ isort==5.12.0 jinja2==3.1.2 jmespath==1.0.1 jsmin==3.0.1 -jsonschema==4.18.3 -jsonschema-specifications==2023.6.1 +jsonschema==4.19.0 +jsonschema-specifications==2023.7.1 lazy-object-proxy==1.9.0 markdown==3.3.7 markdown-exec==1.6.0 @@ -62,22 +62,22 @@ mkdocs-minify-plugin==0.6.4 mkdocs-monorepo-plugin==1.0.5 mkdocstrings==0.22.0 mkdocstrings-python==1.1.0 -mypy==1.4.1 +mypy==1.5.0 mypy-extensions==1.0.0 netaddr==0.8.0 packaging==23.1 -pathspec==0.11.1 +pathspec==0.11.2 pillow==9.5.0 pipdeptree==2.7.1 -platformdirs==3.9.1 +platformdirs==3.10.0 pluggy==1.2.0 ply==3.11 psutil==5.9.5 pycparser==2.21 pygments==2.15.1 -pylint==2.17.4 +pylint==2.17.5 pymdown-extensions==10.0.1 -pyparsing==3.1.0 +pyparsing==3.1.1 pytest==7.4.0 pytest-mock==3.11.1 pytest-plus==0.4.0 @@ -86,12 +86,12 @@ python-dateutil==2.8.2 python-slugify==8.0.1 pyyaml==6.0 pyyaml-env-tag==0.1 -rdflib==6.3.2 -referencing==0.29.1 +rdflib==7.0.0 +referencing==0.30.2 regex==2023.5.5 requests==2.31.0 -rich==13.4.2 -rpds-py==0.8.10 +rich==13.5.2 +rpds-py==0.9.2 ruamel-yaml==0.17.32 six==1.16.0 soupsieve==2.4.1 @@ -100,9 +100,9 @@ subprocess-tee==0.4.1 text-unidecode==1.3 tinycss2==1.2.1 tomli==2.0.1 -tomlkit==0.11.8 -types-jsonschema==4.17.0.9 -types-pyyaml==6.0.12.10 +tomlkit==0.12.1 +types-jsonschema==4.17.0.10 +types-pyyaml==6.0.12.11 typing-extensions==4.6.2 uritools==4.0.1 urllib3==2.0.2 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6a4dae22d6..58fc4c3425 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,6 +10,12 @@ updates: - dependabot-deps-updates - skip-changelog versioning-strategy: lockfile-only + ignore: + - dependency-name: mypy + - dependency-name: pipdeptree + - dependency-name: pylint + - dependency-name: types-jsonschema + - dependency-name: types-pyyaml - package-ecosystem: "github-actions" directory: "/" schedule: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8fbf297c88..4ba5257e35 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: check-useless-excludes - repo: https://github.com/pre-commit/mirrors-prettier # keep it before yamllint - rev: v3.0.1 + rev: v3.0.2 hooks: - id: prettier # Temporary excludes so we can gradually normalize the formatting @@ -63,14 +63,14 @@ repos: - prettier-plugin-toml - prettier-plugin-sort-json - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v6.31.1 + rev: v7.0.0 hooks: - id: cspell # entry: codespell --relative args: [--relative, --no-progress, --no-summary] name: Spell check with cspell - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.23.3 + rev: 0.24.1 hooks: - id: check-github-workflows - repo: https://github.com/pre-commit/pre-commit-hooks.git @@ -130,7 +130,7 @@ repos: types: [file, yaml] entry: yamllint --strict - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.0.282" + rev: "v0.0.284" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -140,7 +140,7 @@ repos: - id: black language_version: python3 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.5.0 hooks: - id: mypy # empty args needed in order to match mypy cli behavior @@ -169,7 +169,7 @@ repos: plugins/.* )$ - repo: https://github.com/pycqa/pylint - rev: v3.0.0a6 + rev: v3.0.0a7 hooks: - id: pylint args: @@ -192,7 +192,7 @@ repos: - wcmatch - yamllint - repo: https://github.com/jazzband/pip-tools - rev: 7.2.0 + rev: 7.3.0 hooks: - id: pip-compile name: lock diff --git a/pyproject.toml b/pyproject.toml index 5f0df672d5..906d57399f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -223,7 +223,7 @@ python_files = [ xfail_strict = true [tool.ruff] -required-version = "0.0.282" +required-version = "0.0.284" ignore = [ "E501", # we use black "ERA001", # auto-removal of commented out code affects development and vscode integration diff --git a/src/ansiblelint/loaders.py b/src/ansiblelint/loaders.py index 49e38f1656..5942ff4b51 100644 --- a/src/ansiblelint/loaders.py +++ b/src/ansiblelint/loaders.py @@ -3,9 +3,9 @@ import logging import os -from collections import defaultdict, namedtuple +from collections import defaultdict from functools import partial -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, NamedTuple import yaml from yaml import YAMLError @@ -19,7 +19,14 @@ if TYPE_CHECKING: from pathlib import Path -IgnoreFile = namedtuple("IgnoreFile", "default alternative") + +class IgnoreFile(NamedTuple): + """IgnoreFile n.""" + + default: str + alternative: str + + IGNORE_FILE = IgnoreFile(".ansible-lint-ignore", ".config/ansible-lint-ignore.txt") yaml_load = partial(yaml.load, Loader=FullLoader) diff --git a/src/ansiblelint/rules/__init__.py b/src/ansiblelint/rules/__init__.py index c2647eaec3..6b8823589b 100644 --- a/src/ansiblelint/rules/__init__.py +++ b/src/ansiblelint/rules/__init__.py @@ -370,7 +370,7 @@ def all_subclasses(cls: type) -> set[type]: class RulesCollection: """Container for a collection of rules.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, rulesdirs: list[str] | list[Path] | None = None, options: Options | None = None, diff --git a/src/ansiblelint/rules/jinja.py b/src/ansiblelint/rules/jinja.py index 146d7a928e..5e7355f9b0 100644 --- a/src/ansiblelint/rules/jinja.py +++ b/src/ansiblelint/rules/jinja.py @@ -4,9 +4,8 @@ import logging import re import sys -from collections import namedtuple from pathlib import Path -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, NamedTuple import black import jinja2 @@ -30,7 +29,14 @@ _logger = logging.getLogger(__package__) KEYWORDS_WITH_IMPLICIT_TEMPLATE = ("changed_when", "failed_when", "until", "when") -Token = namedtuple("Token", "lineno token_type value") + +class Token(NamedTuple): + """Token.""" + + lineno: int + token_type: str + value: str + ignored_re = re.compile( "|".join( # noqa: FLY002 diff --git a/test/schemas/package-lock.json b/test/schemas/package-lock.json index 9bce461da6..d2bdf760b9 100644 --- a/test/schemas/package-lock.json +++ b/test/schemas/package-lock.json @@ -16,7 +16,7 @@ "@types/js-yaml": "^4.0.5", "@types/minimatch": "^5.1.2", "@types/mocha": "^10.0.1", - "@types/node": "^20.4.2", + "@types/node": "^20.5.0", "chai": "^4.3.7", "minimatch": "^9.0.3", "mocha": "^10.2.0", @@ -101,9 +101,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.4.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", - "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==" + "version": "20.5.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.0.tgz", + "integrity": "sha512-Mgq7eCtoTjT89FqNoTzzXg2XvCi5VMhRV6+I2aYanc6kQCBImeNaAYRs/DyoVqk1YEUJK5gN9VO7HRIdz4Wo3Q==" }, "node_modules/@vscode/l10n": { "version": "0.0.13", @@ -1404,9 +1404,9 @@ "dev": true }, "@types/node": { - "version": "20.4.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", - "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==" + "version": "20.5.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.0.tgz", + "integrity": "sha512-Mgq7eCtoTjT89FqNoTzzXg2XvCi5VMhRV6+I2aYanc6kQCBImeNaAYRs/DyoVqk1YEUJK5gN9VO7HRIdz4Wo3Q==" }, "@vscode/l10n": { "version": "0.0.13", diff --git a/test/schemas/package.json b/test/schemas/package.json index faa1ee93cc..ba58782b1b 100644 --- a/test/schemas/package.json +++ b/test/schemas/package.json @@ -16,7 +16,7 @@ "@types/js-yaml": "^4.0.5", "@types/minimatch": "^5.1.2", "@types/mocha": "^10.0.1", - "@types/node": "^20.4.2", + "@types/node": "^20.5.0", "chai": "^4.3.7", "minimatch": "^9.0.3", "mocha": "^10.2.0", diff --git a/test/test_matcherrror.py b/test/test_matcherrror.py index 03d9cbdf88..994793769a 100644 --- a/test/test_matcherrror.py +++ b/test/test_matcherrror.py @@ -143,12 +143,9 @@ def test_matcherror_compare_no_other_fallback( """Check that MatchError comparison with other types causes TypeError.""" expected_error = ( r"^(" - r"unsupported operand type\(s\) for {operator!s}:|" - r"'{operator!s}' not supported between instances of" - r") 'MatchError' and '{other_type!s}'$".format( - other_type=type(other).__name__, - operator=operator_char, - ) + rf"unsupported operand type\(s\) for {operator_char!s}:|" + rf"'{operator_char!s}' not supported between instances of" + rf") 'MatchError' and '{type(other).__name__!s}'$" ) with pytest.raises(TypeError, match=expected_error): operation(MatchError("foo"), other) diff --git a/tox.ini b/tox.ini index 173880cf7d..525b584ddf 100644 --- a/tox.ini +++ b/tox.ini @@ -120,6 +120,7 @@ deps = setenv = # without his upgrade would likely not do anything PIP_CONSTRAINT = /dev/null +commands_pre = commands = -pre-commit run --all-files --show-diff-on-failure --hook-stage manual lock -pre-commit run --all-files --show-diff-on-failure --hook-stage manual up