ansible-test: yamllint, check the assigment

Ensure `yamllint`'s `check_assignment()` correctly ignore the
attribute assignment. Those don't have any `.id` attribute and will
trigger an `AttributeError` exception.

See: https://github.com/ansible/ansible/pull/73322
pull/73587/head
Gonéri Le Bouder 3 years ago committed by Matt Clay
parent f327e65d11
commit 0a8d5c0983

@ -0,0 +1,3 @@
---
bugfixes:
- yamllint - do not raise an ``AttributeError`` if a value is assigned to a module attribute at the top of the module.

@ -199,7 +199,7 @@ class YamlChecker:
def check_assignment(statement, doc_types=None):
"""Check the given statement for a documentation assignment."""
for target in statement.targets:
if isinstance(target, ast.Tuple):
if not isinstance(target, ast.Name):
continue
if doc_types and target.id not in doc_types:

Loading…
Cancel
Save