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
This commit is contained in:
Gonéri Le Bouder 2021-02-09 10:44:17 -05:00 committed by Matt Clay
parent f327e65d11
commit 0a8d5c0983
2 changed files with 4 additions and 1 deletions

View file

@ -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.

View file

@ -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: