diff --git a/.config/requirements-test.txt b/.config/requirements-test.txt index 4175b089ca..4d4c868f24 100644 --- a/.config/requirements-test.txt +++ b/.config/requirements-test.txt @@ -5,6 +5,7 @@ flake8 # IDE support flake8-future-annotations # IDE support jmespath mypy # IDE support +netaddr # needed by ipwrap filter psutil # soft-dep of pytest-xdist pylint # IDE support pytest >= 7.2.2 diff --git a/.config/requirements.txt b/.config/requirements.txt index 54077d0bc2..d46a94a6e5 100644 --- a/.config/requirements.txt +++ b/.config/requirements.txt @@ -63,6 +63,7 @@ mkdocstrings==0.21.2 mkdocstrings-python==0.9.0 mypy==1.2.0 mypy-extensions==1.0.0 +netaddr==0.8.0 packaging==23.0 pathspec==0.11.1 pillow==9.5.0 diff --git a/src/ansiblelint/rules/meta_no_tags.py b/src/ansiblelint/rules/meta_no_tags.py index 8556df38c1..f5fe96b3ba 100644 --- a/src/ansiblelint/rules/meta_no_tags.py +++ b/src/ansiblelint/rules/meta_no_tags.py @@ -106,7 +106,7 @@ def test_valid_tag_rule(rule_runner: RunFromText) -> None: @pytest.mark.parametrize( "rule_runner", (MetaTagValidRule,), indirect=["rule_runner"] ) - def test_no_galaxy_info(rule_runner: Any) -> None: + def test_meta_not_tags(rule_runner: Any) -> None: """Test rule matches.""" results = rule_runner.run( "examples/roles/meta_no_tags_galaxy_info/meta/main.yml" diff --git a/src/ansiblelint/rules/syntax_check.py b/src/ansiblelint/rules/syntax_check.py index cec94e6c4d..84a6a5af5e 100644 --- a/src/ansiblelint/rules/syntax_check.py +++ b/src/ansiblelint/rules/syntax_check.py @@ -230,9 +230,14 @@ def test_extra_vars_passed_to_command(config_options: Any) -> None: def test_syntax_check_role() -> None: """Validate syntax check of a broken role.""" + # pylint: disable=import-outside-toplevel + from ansiblelint.rules import RulesCollection + from ansiblelint.runner import Runner + lintable = Lintable("examples/playbooks/roles/invalid_due_syntax", kind="role") # pylint: disable=protected-access - result = AnsibleSyntaxCheckRule._get_ansible_syntax_check_matches(lintable) + rules = RulesCollection() + result = Runner(lintable, rules=rules).run() assert len(result) == 1, result assert result[0].linenumber == 2 assert result[0].filename == "examples/roles/invalid_due_syntax/tasks/main.yml" diff --git a/src/ansiblelint/runner.py b/src/ansiblelint/runner.py index 64bca9f9b8..f2d0764a62 100644 --- a/src/ansiblelint/runner.py +++ b/src/ansiblelint/runner.py @@ -139,7 +139,7 @@ def worker(lintable: Lintable) -> list[MatchError]: # playbooks: List[Lintable] = [] for lintable in self.lintables: - if lintable.kind != "playbook" or lintable.stop_processing: + if lintable.kind not in ("playbook", "role") or lintable.stop_processing: continue files.append(lintable)