From 3efa9dcf037e3898c8f45bc03d4d4eca060f2c6e Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 10 Jan 2024 15:51:09 +0000 Subject: [PATCH 1/2] Use new ansible-compat verbosity levels --- .config/lock-requirements.txt | 2 +- .config/requirements.txt | 2 +- .config/runtime-requirements.txt | 2 +- .pre-commit-config.yaml | 4 ++-- src/ansiblelint/app.py | 4 +++- test/test_verbosity.py | 4 ++++ 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.config/lock-requirements.txt b/.config/lock-requirements.txt index ffeb99ec12..6af3b77b01 100644 --- a/.config/lock-requirements.txt +++ b/.config/lock-requirements.txt @@ -4,7 +4,7 @@ # # pip-compile --no-annotate --output-file=.config/lock-requirements.txt --strip-extras --unsafe-package=resolvelib --unsafe-package=ruamel-yaml-clib pyproject.toml # -ansible-compat==4.1.10 +ansible-compat==4.1.11 ansible-core==2.16.0 attrs==23.1.0 black==23.10.1 diff --git a/.config/requirements.txt b/.config/requirements.txt index 4a138de284..9c20f1c570 100644 --- a/.config/requirements.txt +++ b/.config/requirements.txt @@ -4,7 +4,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.10 +ansible-compat==4.1.11 ansible-core==2.16.0 astroid==3.0.1 attrs==23.1.0 diff --git a/.config/runtime-requirements.txt b/.config/runtime-requirements.txt index f01b04ee4c..5309c39b54 100644 --- a/.config/runtime-requirements.txt +++ b/.config/runtime-requirements.txt @@ -1,7 +1,7 @@ # Special order section for helping pip: will-not-work-on-windows-try-from-wsl-instead; platform_system=='Windows' ansible-core>=2.12.0 # GPLv3 -ansible-compat>=4.1.10 # GPLv3 +ansible-compat>=4.1.11 # GPLv3 # alphabetically sorted: black>=22.8.0 # MIT filelock>=3.3.0 # The Unlicense diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e6d18f3b14..ba0a5bd150 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -151,7 +151,7 @@ repos: # empty args needed in order to match mypy cli behavior args: [--strict] additional_dependencies: - - ansible-compat>=4.1.10 + - ansible-compat>=4.1.11 - black>=22.10.0 - cryptography>=39.0.1 - filelock>=3.12.2 @@ -180,7 +180,7 @@ repos: args: - --output-format=colorized additional_dependencies: - - ansible-compat>=4.1.10 + - ansible-compat>=4.1.11 - ansible-core>=2.14.0 - black>=22.10.0 - docutils diff --git a/src/ansiblelint/app.py b/src/ansiblelint/app.py index 6ef92ed953..8b04383cc9 100644 --- a/src/ansiblelint/app.py +++ b/src/ansiblelint/app.py @@ -46,7 +46,9 @@ def __init__(self, options: Options): self.formatter = formatter_factory(options.cwd, options.display_relative_path) # Without require_module, our _set_collections_basedir may fail - self.runtime = Runtime(isolated=True, require_module=True) + self.runtime = Runtime( + isolated=True, require_module=True, verbosity=options.verbosity + ) def render_matches(self, matches: list[MatchError]) -> None: """Display given matches (if they are not fixed).""" diff --git a/test/test_verbosity.py b/test/test_verbosity.py index d3ddb3c20b..6dbcd1f4d8 100644 --- a/test/test_verbosity.py +++ b/test/test_verbosity.py @@ -6,6 +6,7 @@ import pytest from ansiblelint.testing import run_ansible_lint +from ansiblelint.text import strip_ansi_escape # substrs is a list of tuples, where: @@ -83,6 +84,9 @@ def test_verbosity( else: result = run_ansible_lint(str(fakerole), cwd=project_path) + result.stderr = strip_ansi_escape(result.stderr) + result.stdout = strip_ansi_escape(result.stdout) + assert result.returncode == 2, result for substr, invert in substrs: if invert: assert substr not in result.stderr, result.stderr From 2f35c7fbaa3ba3fb2f0fbcf6e06f94ba410e0dc2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:29:31 +0000 Subject: [PATCH 2/2] chore: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/ansiblelint/app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ansiblelint/app.py b/src/ansiblelint/app.py index 8b04383cc9..6042cf15bd 100644 --- a/src/ansiblelint/app.py +++ b/src/ansiblelint/app.py @@ -47,7 +47,9 @@ def __init__(self, options: Options): # Without require_module, our _set_collections_basedir may fail self.runtime = Runtime( - isolated=True, require_module=True, verbosity=options.verbosity + isolated=True, + require_module=True, + verbosity=options.verbosity, ) def render_matches(self, matches: list[MatchError]) -> None: