Skip to content

Commit

Permalink
Avoid ruamel.yaml 0.18.7-0.18.8 due to regression (#4462)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Jan 3, 2025
1 parent 5d8888f commit 37dd23d
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 40 deletions.
8 changes: 4 additions & 4 deletions .config/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ mkdocs-minify-plugin==0.8.0 # via mkdocs-ansible
mkdocs-monorepo-plugin==1.1.0 # via mkdocs-ansible
mkdocstrings==0.27.0 # via mkdocs-ansible, mkdocstrings-python
mkdocstrings-python==1.13.0 # via mkdocs-ansible
mypy==1.14.0 # via ansible-lint (pyproject.toml)
mypy==1.14.1 # via ansible-lint (pyproject.toml)
mypy-extensions==1.0.0 # via black, mypy
netaddr==1.3.0 # via ansible-lint (pyproject.toml)
packaging==24.2 # via ansible-compat, ansible-core, black, mkdocs, mkdocs-macros-plugin, pyproject-api, pytest, tox, ansible-lint (pyproject.toml)
paginate==0.5.7 # via mkdocs-material
pathspec==0.12.1 # via black, mkdocs, mkdocs-macros-plugin, yamllint, ansible-lint (pyproject.toml)
pillow==11.0.0 # via cairosvg, mkdocs-ansible
pillow==11.1.0 # via cairosvg, mkdocs-ansible
platformdirs==4.3.6 # via black, mkdocs-get-deps, mkdocstrings, pylint, tox, virtualenv
pluggy==1.5.0 # via pytest, tox
psutil==6.1.1 # via pytest-xdist, ansible-lint (pyproject.toml)
Expand Down Expand Up @@ -105,9 +105,9 @@ tomli==2.2.1 # via black, coverage, mypy, pylint, pyproject-api, py
tomlkit==0.13.2 # via pylint
tox==4.23.2 # via ansible-lint (pyproject.toml)
types-jsonschema==4.23.0.20241208 # via ansible-lint (pyproject.toml)
types-pyyaml==6.0.12.20241221 # via ansible-lint (pyproject.toml)
types-pyyaml==6.0.12.20241230 # via ansible-lint (pyproject.toml)
urllib3==2.3.0 # via requests
virtualenv==20.28.0 # via tox
virtualenv==20.28.1 # via tox
watchdog==6.0.0 # via mkdocs
wcmatch==10.0 # via ansible-lint (pyproject.toml)
webencodings==0.5.1 # via cssselect2, tinycss2
Expand Down
2 changes: 1 addition & 1 deletion .config/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jsonschema>=4.10.0 # MIT, version needed for improved errors
packaging>=21.3 # Apache-2.0,BSD-2-Clause
pathspec>=0.10.3 # Mozilla Public License 2.0 (MPL 2.0)
pyyaml>=5.4.1 # MIT (centos 9 has 5.3.1)
ruamel.yaml>=0.18.5 # MIT
ruamel.yaml>=0.18.5,!=0.18.7,!=0.18.8 # MIT
subprocess-tee>=0.4.1 # MIT, used by ansible-compat
yamllint >= 1.30.0 # GPLv3
wcmatch>=8.1.2; python_version < '3.12' # MIT
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ repos:
- [email protected]
- [email protected]
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.16.0
rev: v8.17.0
hooks:
- id: cspell
# entry: codespell --relative
Expand Down Expand Up @@ -134,7 +134,7 @@ repos:
hooks:
- id: toml-sort-fix
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
rev: v0.8.5
hooks:
- id: ruff
args:
Expand All @@ -148,7 +148,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
# empty args needed in order to match mypy cli behavior
Expand Down Expand Up @@ -179,7 +179,7 @@ repos:
plugins/.*
)$
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.389
rev: v1.1.391
hooks:
- id: pyright
additional_dependencies:
Expand All @@ -203,7 +203,7 @@ repos:
- wcmatch
- yamllint
- repo: https://github.com/pycqa/pylint
rev: v3.3.2
rev: v3.3.3
hooks:
- id: pylint
args:
Expand All @@ -227,7 +227,7 @@ repos:
- wcmatch
- yamllint
- repo: https://github.com/jendrikseipp/vulture
rev: v2.13
rev: v2.14
hooks:
- id: vulture
- # keep at bottom as these are slower
Expand Down
4 changes: 2 additions & 2 deletions src/ansiblelint/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ def __repr__(self) -> str:
formatstr = "[{0}] ({1}) matched {2}:{3} {4}"
# note that `rule.id` can be int, str or even missing, as users
# can defined their own custom rules.
_id = getattr(self.rule, "id", "000")
id_ = getattr(self.rule, "id", "000")

return formatstr.format(
_id,
id_,
self.message,
self.filename,
self.lineno,
Expand Down
3 changes: 1 addition & 2 deletions src/ansiblelint/rules/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ def matchtask(
module_args.update(workarounds_inject_map[loaded_module.resolved_fqcn])
if loaded_module.resolved_fqcn in workarounds_drop_map:
for key in workarounds_drop_map[loaded_module.resolved_fqcn]:
if key in module_args:
del module_args[key]
module_args.pop(key, None)

with mock.patch.object(
mock_ansible_module,
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblelint/schemas/__store__.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ansible-lint-config": {
"etag": "8e626a1196cba4ac67956e6891090991a29aec6e8949e16a58f41773da055ca8",
"etag": "edfce2b56aae684bf1f0b9978dcfaaaa588dbc236f6e0ce29427277f6a327ddc",
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible-lint-config.json"
},
"ansible-navigator-config": {
Expand Down
5 changes: 3 additions & 2 deletions src/ansiblelint/schemas/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import json
import logging
import re
import typing
from typing import TYPE_CHECKING, Any

import yaml
Expand All @@ -18,6 +17,8 @@
_logger = logging.getLogger(__package__)

if TYPE_CHECKING:
from collections.abc import Iterator

from ansiblelint.file_utils import Lintable


Expand All @@ -28,7 +29,7 @@ def find_best_deep_match(

def iter_validation_error(
err: ValidationError,
) -> typing.Iterator[ValidationError]:
) -> Iterator[ValidationError]:
if err.context:
for e in err.context:
yield e
Expand Down
8 changes: 4 additions & 4 deletions src/ansiblelint/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,18 @@ def run_ansible_lint(
"VIRTUAL_ENV",
]

_env = {} if env is None else env
env_ = {} if env is None else env
for v in safe_list:
if v in os.environ and v not in _env:
_env[v] = os.environ[v]
if v in os.environ and v not in env_:
env_[v] = os.environ[v]

return subprocess.run(
args,
capture_output=True,
shell=False, # needed when command is a list
check=False,
cwd=cwd,
env=_env,
env=env_,
text=True,
encoding="utf-8",
)
14 changes: 7 additions & 7 deletions src/ansiblelint/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,12 +735,12 @@ def task_to_str(task: dict[str, Any]) -> str:
]
]

_raw_params = action.get("_raw_params", [])
if isinstance(_raw_params, list):
for item in _raw_params:
raw_params = action.get("_raw_params", [])
if isinstance(raw_params, list):
for item in raw_params:
args.extend(str(item))
else:
args.append(_raw_params)
args.append(raw_params)

return f"{action['__ansible_module__']} {' '.join(args)}"

Expand Down Expand Up @@ -934,18 +934,18 @@ def each_entry(data: AnsibleBaseYAMLObject, position: str) -> Iterator[Task]: #
for entry_index, entry in enumerate(data):
if not entry:
continue
_pos = f"{position}[{entry_index}]"
pos_ = f"{position}[{entry_index}]"
if isinstance(entry, dict):
yield Task(
entry,
position=_pos,
position=pos_,
)
for block in [k for k in entry if k in NESTED_TASK_KEYS]:
yield from task_in_list(
data=entry[block],
file=file,
kind="tasks",
position=f"{_pos}.{block}",
position=f"{pos_}.{block}",
)

if not isinstance(data, list):
Expand Down
14 changes: 7 additions & 7 deletions test/schemas/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/schemas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@types/js-yaml": "^4.0.9",
"@types/minimatch": "^5.1.2",
"@types/mocha": "^10.0.10",
"@types/node": "^22.10.1",
"@types/node": "^22.10.5",
"chai": "^5.1.2",
"minimatch": "^10.0.1",
"mocha": "^11.0.1",
Expand Down
2 changes: 1 addition & 1 deletion test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def test_path_from_config_do_not_depend_on_cwd(
)
def test_config_failure(base_arguments: list[str], config_file: str) -> None:
"""Ensures specific config files produce error code 3."""
with pytest.raises(SystemExit, match="^3$"):
with pytest.raises(SystemExit, match=r"^3$"):
cli.get_config([*base_arguments, "-c", config_file])


Expand Down
4 changes: 2 additions & 2 deletions test/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,15 +508,15 @@ def test_transform_na(
result = test_result[0]
options = test_result[1]

_isinstance = builtins.isinstance
isinstance_ = builtins.isinstance
called = False

def mp_isinstance(t_object: Any, classinfo: type) -> bool:
if classinfo is TransformMixin:
nonlocal called
called = True
return False
return _isinstance(t_object, classinfo)
return isinstance_(t_object, classinfo)

monkeypatch.setattr(builtins, "isinstance", mp_isinstance)

Expand Down

0 comments on commit 37dd23d

Please sign in to comment.