ansible-test: yamllint, check the assigment (#73583)
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
(cherry picked from commit 0a8d5c0983
)
This commit is contained in:
parent
ab8bbe269d
commit
b1d278a595
2 changed files with 4 additions and 1 deletions
|
@ -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.
|
|
@ -180,7 +180,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…
Reference in a new issue