From 05019fe033d6215b09175e3603ab446fea92035f Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Fri, 14 Aug 2020 09:22:01 +0100 Subject: [PATCH] Add rule violations from Yamllint Also detect yamllint rule violations when this is found as installed. This will allow us to remove a set of rules that overlapped with general YAML syntax ones. Fixes: #953 --- .ansible-lint | 7 ++ .pre-commit-config.yaml | 1 + .yamllint | 5 ++ examples/example.yml | 4 +- lib/ansiblelint/errors.py | 8 +- lib/ansiblelint/rules/LineTooLongRule.py | 19 ----- .../rules/TrailingWhitespaceRule.py | 34 -------- lib/ansiblelint/rules/YamllintRule.py | 82 +++++++++++++++++++ lib/ansiblelint/rules/__init__.py | 9 +- lib/ansiblelint/runner.py | 2 +- lib/ansiblelint/testing/__init__.py | 11 ++- lib/ansiblelint/utils.py | 4 +- mypy.ini | 3 + setup.cfg | 3 + test/TestExamples.py | 2 +- test/TestLineTooLong.py | 6 +- test/TestMatchError.py | 4 +- test/TestMissingFilePermissionsRule.py | 14 ++-- test/TestNestedJinjaRule.py | 26 +++--- test/TestRunner.py | 2 +- test/TestSkipImportPlaybook.py | 4 +- test/TestSkipInsideYaml.py | 10 +-- test/TestWithSkipTagId.py | 4 +- tox.ini | 1 + 24 files changed, 160 insertions(+), 105 deletions(-) delete mode 100644 lib/ansiblelint/rules/LineTooLongRule.py delete mode 100644 lib/ansiblelint/rules/TrailingWhitespaceRule.py create mode 100644 lib/ansiblelint/rules/YamllintRule.py diff --git a/.ansible-lint b/.ansible-lint index 8e7ec0030ac..ef5578248bb 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,2 +1,9 @@ +extends: default +rules: + document-start: disable + # 160 chars was the default used by old E204 rule, but + # you can easily change it or disable in your .yamllint file. + line-length: + max: 160 exclude_paths: - .github/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ec0aca0bdd9..c68b0000956 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,6 +65,7 @@ repos: args: [] additional_dependencies: - Sphinx>=3.1.2 + - yamllint - repo: https://github.com/pre-commit/mirrors-pylint rev: v2.6.0 hooks: diff --git a/.yamllint b/.yamllint index c7a1f61d34e..ed219b22b0a 100644 --- a/.yamllint +++ b/.yamllint @@ -1,4 +1,9 @@ rules: + document-start: disable indentation: level: error indent-sequences: consistent +ignore: | + .tox + examples/example.yml +# ignore added because this file includes on-purpose errors diff --git a/examples/example.yml b/examples/example.yml index 1ce910de051..d47b8816807 100644 --- a/examples/example.yml +++ b/examples/example.yml @@ -33,8 +33,8 @@ - name: passing git as an argument to another task action: debug msg="{{item}}" with_items: - - git - - bobbins + - git # yamllint wrong indentation + - bobbins - name: yum latest yum: state=latest name=httpd diff --git a/lib/ansiblelint/errors.py b/lib/ansiblelint/errors.py index 68434fe72b3..727da96aa3b 100644 --- a/lib/ansiblelint/errors.py +++ b/lib/ansiblelint/errors.py @@ -1,7 +1,7 @@ """Exceptions and error representations.""" import functools import os -from typing import Any, Optional, Type +from typing import Any, Optional from ansiblelint._internal.rules import BaseRule, RuntimeErrorRule from ansiblelint.file_utils import normpath @@ -29,13 +29,13 @@ def __init__( linenumber: int = 0, details: str = "", filename: Optional[str] = None, - rule: Type[BaseRule] = RuntimeErrorRule, + rule: BaseRule = RuntimeErrorRule(), tag: Optional[str] = None # optional fine-graded tag ) -> None: """Initialize a MatchError instance.""" super().__init__(message) - if rule is RuntimeErrorRule and not message: + if rule.__class__ is RuntimeErrorRule and not message: raise TypeError( f'{self.__class__.__name__}() missing a ' "required argument: one of 'message' or 'rule'", @@ -50,6 +50,8 @@ def __init__( self.filename = os.getcwd() self.rule = rule self.ignored = False # If set it will be displayed but not counted as failure + # This can be used by rules that can report multiple errors type, so + # we can still filter by them. self.tag = tag def __repr__(self) -> str: diff --git a/lib/ansiblelint/rules/LineTooLongRule.py b/lib/ansiblelint/rules/LineTooLongRule.py deleted file mode 100644 index 9e6e057d7e1..00000000000 --- a/lib/ansiblelint/rules/LineTooLongRule.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2016, Will Thames and contributors -# Copyright (c) 2018, Ansible Project - -from ansiblelint.rules import AnsibleLintRule - - -class LineTooLongRule(AnsibleLintRule): - id = '204' - shortdesc = 'Lines should be no longer than 160 chars' - description = ( - 'Long lines make code harder to read and ' - 'code review more difficult' - ) - severity = 'VERY_LOW' - tags = ['formatting'] - version_added = 'v4.0.0' - - def match(self, line: str) -> bool: - return len(line) > 160 diff --git a/lib/ansiblelint/rules/TrailingWhitespaceRule.py b/lib/ansiblelint/rules/TrailingWhitespaceRule.py deleted file mode 100644 index 2fe7e7974c4..00000000000 --- a/lib/ansiblelint/rules/TrailingWhitespaceRule.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2013-2014 Will Thames -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -from ansiblelint.rules import AnsibleLintRule - - -class TrailingWhitespaceRule(AnsibleLintRule): - id = '201' - shortdesc = 'Trailing whitespace' - description = 'There should not be any trailing whitespace' - severity = 'INFO' - tags = ['formatting'] - version_added = 'historic' - - def match(self, line: str) -> bool: - line = line.replace("\r", "") - return line.rstrip() != line diff --git a/lib/ansiblelint/rules/YamllintRule.py b/lib/ansiblelint/rules/YamllintRule.py new file mode 100644 index 00000000000..b53fe87e4c4 --- /dev/null +++ b/lib/ansiblelint/rules/YamllintRule.py @@ -0,0 +1,82 @@ +import logging +import os +import sys +from typing import TYPE_CHECKING, List + +from ansiblelint.rules import AnsibleLintRule + +if TYPE_CHECKING: + from ansiblelint.errors import MatchError + +_logger = logging.getLogger(__name__) + +# yamllint is a soft-dependency (not installed by default) +try: + from yamllint.config import YamlLintConfig + from yamllint.linter import run as run_yamllint +except ImportError: + pass + + +YAMLLINT_CONFIG = """ +extends: default +rules: + document-start: disable + # 160 chars was the default used by old E204 rule, but + # you can easily change it or disable in your .yamllint file. + line-length: + max: 160 +""" + +DESCRIPTION = """\ +Rule violations reported by YamlLint when this is installed. + +You can fully disable all of them by adding `YAML` to the `skip_list`. + +Specific tag identifiers that are printed at the end of rule name, +like `trailing-spaces` or `indentation` can also be be skipped, allowing +you to have a more fine control. +""" + + +class YamllintRule(AnsibleLintRule): + id = 'YAML' + shortdesc = 'Violations reported by yamllint' + description = DESCRIPTION + severity = 'VERY_LOW' + tags = ['formatting', 'experimental', 'yamllint'] + version_added = 'v5.0.0' + config = None + if "yamllint.config" in sys.modules: + config = YamlLintConfig(content=YAMLLINT_CONFIG) + # if we detect local yamllint config we use it but raise a warning + # as this is likely to get out of sync with our internal config. + for file in ['.yamllint', '.yamllint.yaml', '.yamllint.yml']: + if os.path.isfile(file): + _logger.warning( + "Loading custom %s config file, this extends our " + "internal yamllint config.", + file) + config_override = YamlLintConfig(file=file) + config_override.extend(config) + break + _logger.warning("Effective yamllint rules used: %s", config.rules) + + def __init__(self) -> None: + """Construct a rule instance.""" + # customize id by adding the one reported by yamllint + self.id = self.__class__.id + + def matchyaml(self, file, text: str) -> List["MatchError"]: + """Return matches found for a specific YAML text.""" + matches = [] + if YamllintRule.config: + for p in run_yamllint(text, YamllintRule.config): + matches.append( + self.create_matcherror( + message=p.desc, + linenumber=p.line, + details="", + filename=file['path'], + tag=p.rule)) + return matches diff --git a/lib/ansiblelint/rules/__init__.py b/lib/ansiblelint/rules/__init__.py index dd386c45725..5153af36658 100644 --- a/lib/ansiblelint/rules/__init__.py +++ b/lib/ansiblelint/rules/__init__.py @@ -1,4 +1,5 @@ """All internal ansible-lint rules.""" +import copy import glob import importlib.util import logging @@ -42,7 +43,7 @@ def create_matcherror( linenumber=linenumber, details=details, filename=filename, - rule=self.__class__ + rule=copy.copy(self) ) if tag: match.tag = tag @@ -250,7 +251,7 @@ def run(self, playbookfile, tags=set(), skip_list=frozenset()) -> List: return [MatchError( message=str(error), filename=playbookfile['path'], - rule=LoadingFailureRule)] + rule=LoadingFailureRule())] for rule in self.rules: if not tags or not set(rule.tags).union([rule.id]).isdisjoint(tags): @@ -261,6 +262,10 @@ def run(self, playbookfile, tags=set(), skip_list=frozenset()) -> List: matches.extend(rule.matchtasks(playbookfile, text)) matches.extend(rule.matchyaml(playbookfile, text)) + # some rules can produce matches with tags that are inside our + # skip_list, so we need to cleanse the matches + matches = [m for m in matches if m.tag not in skip_list] + return matches def __repr__(self) -> str: diff --git a/lib/ansiblelint/runner.py b/lib/ansiblelint/runner.py index 1e42b31f4a0..3264aefc490 100644 --- a/lib/ansiblelint/runner.py +++ b/lib/ansiblelint/runner.py @@ -119,6 +119,6 @@ def _emit_matches(self, files: List) -> Generator[MatchError, None, None]: self.playbooks.add((child['path'], child['type'])) files.append(child) except MatchError as e: - e.rule = LoadingFailureRule + e.rule = LoadingFailureRule() yield e visited.add(arg) diff --git a/lib/ansiblelint/testing/__init__.py b/lib/ansiblelint/testing/__init__.py index 1ed686f8fa3..00426646b4e 100644 --- a/lib/ansiblelint/testing/__init__.py +++ b/lib/ansiblelint/testing/__init__.py @@ -5,16 +5,13 @@ import subprocess import sys import tempfile -from typing import TYPE_CHECKING, Dict, List +from typing import Dict, List from ansible import __version__ as ansible_version_str +from ansiblelint.errors import MatchError from ansiblelint.runner import Runner -if TYPE_CHECKING: - from ansiblelint.errors import MatchError - - ANSIBLE_MAJOR_VERSION = tuple(map(int, ansible_version_str.split('.')[:2])) @@ -29,8 +26,10 @@ def _call_runner(self, path) -> List["MatchError"]: runner = Runner(self.collection, path) return runner.run() - def run_playbook(self, playbook_text): + def run_playbook(self, playbook_text: str) -> List[MatchError]: """Lints received text as a playbook.""" + # remove newlines from beging and end of examples + playbook_text = playbook_text.lstrip("\n") with tempfile.NamedTemporaryFile(mode="w", suffix=".yml", prefix="playbook") as fp: fp.write(playbook_text) fp.flush() diff --git a/lib/ansiblelint/utils.py b/lib/ansiblelint/utils.py index 3907922869b..47c0fb5cc38 100644 --- a/lib/ansiblelint/utils.py +++ b/lib/ansiblelint/utils.py @@ -273,7 +273,7 @@ def _taskshandlers_children(basedir, k, v, parent_type: FileType) -> List: if v is None: raise MatchError( message="A malformed block was encountered while loading a block.", - rule=RuntimeErrorRule) + rule=RuntimeErrorRule()) for th in v: # ignore empty tasks, `-` @@ -458,7 +458,7 @@ def normalize_task_v2(task: dict) -> dict: # noqa: C901 action, arguments, result['delegate_to'] = mod_arg_parser.parse() except AnsibleParserError as e: raise MatchError( - rule=AnsibleParserErrorRule, + rule=AnsibleParserErrorRule(), message=e.message, filename=task.get(FILENAME_KEY, "Unknown"), linenumber=task.get(LINE_NUMBER_KEY, 0), diff --git a/mypy.ini b/mypy.ini index 3b94f983b32..56cc036c0c0 100644 --- a/mypy.ini +++ b/mypy.ini @@ -35,3 +35,6 @@ ignore_missing_imports = True [mypy-sphinx_ansible_theme] ignore_missing_imports = True + +[mypy-yamllint.*] +ignore_missing_imports = True diff --git a/setup.cfg b/setup.cfg index 7a53d23cfb7..0e0d37e647f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -95,6 +95,9 @@ core = # will install ansible from devel branch, may break at any moment. devel = ansible-core @ git+https://github.com/ansible/ansible.git +# yamllint must remain optional +yamllint = + yamllint >= 1.25.0 # GPL [options.packages.find] where = lib diff --git a/test/TestExamples.py b/test/TestExamples.py index 17a10dfc78a..7eb73a26958 100644 --- a/test/TestExamples.py +++ b/test/TestExamples.py @@ -5,7 +5,7 @@ def test_example(default_rules_collection): """example.yml is expected to have 15 match errors inside.""" result = Runner(default_rules_collection, 'examples/example.yml', [], [], []).run() - assert len(result) == 15 + assert len(result) == 16 def test_example_plain_string(default_rules_collection): diff --git a/test/TestLineTooLong.py b/test/TestLineTooLong.py index be8c6f71e29..f029a837565 100644 --- a/test/TestLineTooLong.py +++ b/test/TestLineTooLong.py @@ -2,10 +2,10 @@ import unittest from ansiblelint.rules import RulesCollection -from ansiblelint.rules.LineTooLongRule import LineTooLongRule +from ansiblelint.rules.YamllintRule import YamllintRule from ansiblelint.testing import RunFromText -LONG_LINE = ''' +LONG_LINE = '''\ - name: task example debug: msg: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua tempor incididunt ut labore et dolore' @@ -14,7 +14,7 @@ class TestLineTooLongRule(unittest.TestCase): collection = RulesCollection() - collection.register(LineTooLongRule()) + collection.register(YamllintRule()) def setUp(self): self.runner = RunFromText(self.collection) diff --git a/test/TestMatchError.py b/test/TestMatchError.py index f17d8656a79..ef611833194 100644 --- a/test/TestMatchError.py +++ b/test/TestMatchError.py @@ -76,9 +76,9 @@ def test_matcherror_invalid(): # filenames takes priority in sorting (MatchError("a", filename="b"), MatchError("a", filename="a")), # rule id 501 > rule id 101 - (MatchError(rule=BecomeUserWithoutBecomeRule), MatchError(rule=AlwaysRunRule)), + (MatchError(rule=BecomeUserWithoutBecomeRule()), MatchError(rule=AlwaysRunRule())), # rule id "200" > rule id 101 - (MatchError(rule=AnsibleLintRuleWithStringId), MatchError(rule=AlwaysRunRule)), + (MatchError(rule=AnsibleLintRuleWithStringId()), MatchError(rule=AlwaysRunRule())), # details are taken into account (MatchError("a", details="foo"), MatchError("a", details="bar")), )) diff --git a/test/TestMissingFilePermissionsRule.py b/test/TestMissingFilePermissionsRule.py index 49f41872cee..c11bbaa1087 100644 --- a/test/TestMissingFilePermissionsRule.py +++ b/test/TestMissingFilePermissionsRule.py @@ -105,10 +105,10 @@ def test_fail(rule_runner): """Validate that missing mode triggers the rule.""" results = rule_runner.run_playbook(FAIL_TASKS) assert len(results) == 5 - assert results[0].linenumber == 5 - assert results[1].linenumber == 9 - assert results[2].linenumber == 13 - # assert results[3].linenumber == 17 - assert results[3].linenumber == 21 - assert results[4].linenumber == 26 - # assert results[6].linenumber == 30 + assert results[0].linenumber == 4 + assert results[1].linenumber == 8 + assert results[2].linenumber == 12 + # assert results[3].linenumber == 16 + assert results[3].linenumber == 20 + assert results[4].linenumber == 25 + # assert results[6].linenumber == 29 diff --git a/test/TestNestedJinjaRule.py b/test/TestNestedJinjaRule.py index 946522a5b91..e017281acbd 100644 --- a/test/TestNestedJinjaRule.py +++ b/test/TestNestedJinjaRule.py @@ -24,7 +24,7 @@ from ansiblelint.file_utils import Lintable -FAIL_TASK_1LN = Lintable('playbook.yml', ''' +FAIL_TASK_1LN = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: one-level nesting @@ -32,7 +32,7 @@ var_one: "2*(1+2) is {{ 2 * {{ 1 + 2 }} }}" ''') -FAIL_TASK_1LN_M = Lintable('playbook.yml', ''' +FAIL_TASK_1LN_M = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: one-level multiline nesting @@ -43,7 +43,7 @@ }} ''') -FAIL_TASK_2LN = Lintable('playbook.yml', ''' +FAIL_TASK_2LN = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: two-level nesting @@ -51,7 +51,7 @@ var_two: "2*(1+(3-1)) is {{ 2 * {{ 1 + {{ 3 - 1 }} }} }}" ''') -FAIL_TASK_2LN_M = Lintable('playbook.yml', ''' +FAIL_TASK_2LN_M = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: two-level multiline nesting @@ -63,7 +63,7 @@ }} }} ''') -FAIL_TASK_W_5LN = Lintable('playbook.yml', ''' +FAIL_TASK_W_5LN = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: five-level wild nesting @@ -71,7 +71,7 @@ var_three_wld: "{{ {{ {{ {{ {{ 234 }} }} }} }} }}" ''') -FAIL_TASK_W_5LN_M = Lintable('playbook.yml', ''' +FAIL_TASK_W_5LN_M = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: five-level wild multiline nesting @@ -88,7 +88,7 @@ }} ''') -SUCCESS_TASK_P = Lintable('playbook.yml', ''' +SUCCESS_TASK_P = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: non-nested example @@ -96,7 +96,7 @@ var_one: "number for 'one' is {{ 2 * 1 }}" ''') -SUCCESS_TASK_P_M = Lintable('playbook.yml', ''' +SUCCESS_TASK_P_M = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: multiline non-nested example @@ -106,7 +106,7 @@ 2 * 1 }} ''') -SUCCESS_TASK_2P = Lintable('playbook.yml', ''' +SUCCESS_TASK_2P = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: nesting far from each other @@ -114,7 +114,7 @@ var_two: "number for 'two' is {{ 2 * 1 }} and number for 'three' is {{ 4 - 1 }}" ''') -SUCCESS_TASK_2P_M = Lintable('playbook.yml', ''' +SUCCESS_TASK_2P_M = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: multiline nesting far from each other @@ -125,7 +125,7 @@ 4 - 1 }} ''') -SUCCESS_TASK_C_2P = Lintable('playbook.yml', ''' +SUCCESS_TASK_C_2P = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: nesting close to each other @@ -133,7 +133,7 @@ var_three: "number for 'ten' is {{ 2 - 1 }}{{ 3 - 3 }}" ''') -SUCCESS_TASK_C_2P_M = Lintable('playbook.yml', ''' +SUCCESS_TASK_C_2P_M = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: multiline nesting close to each other @@ -144,7 +144,7 @@ }}{{ 3 - 3 }} ''') -SUCCESS_TASK_PRINT = Lintable('playbook.yml', ''' +SUCCESS_TASK_PRINT = Lintable('playbook.yml', '''\ - hosts: all tasks: - name: print curly braces diff --git a/test/TestRunner.py b/test/TestRunner.py index 5ca2c03708d..84233ed40fc 100644 --- a/test/TestRunner.py +++ b/test/TestRunner.py @@ -30,7 +30,7 @@ @pytest.mark.parametrize(('playbook', 'exclude', 'length'), ( ('test/nomatchestest.yml', [], 0), - ('test/unicode.yml', [], 1), + ('test/unicode.yml', [], 3), (LOTS_OF_WARNINGS_PLAYBOOK, [LOTS_OF_WARNINGS_PLAYBOOK], 0), ('test/block.yml', [], 1), ('test/block-null.yml', [], 1), diff --git a/test/TestSkipImportPlaybook.py b/test/TestSkipImportPlaybook.py index 626ecb7abdd..93761496741 100644 --- a/test/TestSkipImportPlaybook.py +++ b/test/TestSkipImportPlaybook.py @@ -2,7 +2,7 @@ from ansiblelint.runner import Runner -IMPORTED_PLAYBOOK = ''' +IMPORTED_PLAYBOOK = '''\ - hosts: all tasks: - name: success @@ -10,7 +10,7 @@ when: false ''' -MAIN_PLAYBOOK = ''' +MAIN_PLAYBOOK = '''\ - hosts: all tasks: diff --git a/test/TestSkipInsideYaml.py b/test/TestSkipInsideYaml.py index 12c2fbc336d..4fb41f40fda 100644 --- a/test/TestSkipInsideYaml.py +++ b/test/TestSkipInsideYaml.py @@ -1,6 +1,6 @@ import pytest -ROLE_TASKS = ''' +ROLE_TASKS = '''\ --- - name: test 303 command: git log @@ -10,7 +10,7 @@ changed_when: false ''' -ROLE_TASKS_WITH_BLOCK = ''' +ROLE_TASKS_WITH_BLOCK = '''\ --- - name: bad git 1 # noqa 401 action: git a=b c=d @@ -34,7 +34,7 @@ action: git a=b c=d ''' -PLAYBOOK = ''' +PLAYBOOK = '''\ - hosts: all tasks: - name: test 402 @@ -75,14 +75,14 @@ - skip_ansible_lint ''' -ROLE_META = ''' +ROLE_META = '''\ galaxy_info: # noqa 701 author: your name # noqa 703 description: missing min_ansible_version and platforms. author default not changed license: MIT ''' -ROLE_TASKS_WITH_BLOCK_BECOME = ''' +ROLE_TASKS_WITH_BLOCK_BECOME = '''\ - hosts: tasks: - name: foo diff --git a/test/TestWithSkipTagId.py b/test/TestWithSkipTagId.py index 4ff7a1f6137..340b50774e7 100644 --- a/test/TestWithSkipTagId.py +++ b/test/TestWithSkipTagId.py @@ -2,13 +2,13 @@ import unittest from ansiblelint.rules import RulesCollection -from ansiblelint.rules.TrailingWhitespaceRule import TrailingWhitespaceRule +from ansiblelint.rules.YamllintRule import YamllintRule from ansiblelint.runner import Runner class TestWithSkipTagId(unittest.TestCase): collection = RulesCollection() - collection.register(TrailingWhitespaceRule()) + collection.register(YamllintRule()) file = 'test/with-skip-tag-id.yml' def test_negative_no_param(self): diff --git a/tox.ini b/tox.ini index c5041f00c74..6aee3063b0e 100644 --- a/tox.ini +++ b/tox.ini @@ -16,6 +16,7 @@ description = ansible29: ansible 2.9 core: ansible-base 2.10 extras = + yamllint core: core devel: devel deps =