summaryrefslogtreecommitdiffstats
path: root/src/ansiblelint/skip_utils.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:24:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:24:57 +0000
commit1faea9a6c75f33109e8f66b57b432fdad57b3f46 (patch)
tree4184ce38ac0cf9d5a46bbbae03c87be82927f12b /src/ansiblelint/skip_utils.py
parentAdding upstream version 6.17.2. (diff)
downloadansible-lint-upstream.tar.xz
ansible-lint-upstream.zip
Adding upstream version 24.6.1.upstream/24.6.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ansiblelint/skip_utils.py')
-rw-r--r--src/ansiblelint/skip_utils.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/ansiblelint/skip_utils.py b/src/ansiblelint/skip_utils.py
index f2f6177..e1a3a8f 100644
--- a/src/ansiblelint/skip_utils.py
+++ b/src/ansiblelint/skip_utils.py
@@ -199,7 +199,7 @@ def _append_skipped_rules(
ruamel_tasks = _get_tasks_from_blocks(ruamel_task_blocks)
# append skipped_rules for each task
- for ruamel_task, pyyaml_task in zip(ruamel_tasks, pyyaml_tasks):
+ for ruamel_task, pyyaml_task in zip(ruamel_tasks, pyyaml_tasks, strict=False):
# ignore empty tasks
if not pyyaml_task and not ruamel_task:
continue
@@ -240,7 +240,7 @@ def _get_tasks_from_blocks(task_blocks: Sequence[Any]) -> Generator[Any, None, N
if not task or not is_nested_task(task):
return
for k in NESTED_TASK_KEYS:
- if k in task and task[k]:
+ if task.get(k):
if hasattr(task[k], "get"):
continue
for subtask in task[k]:
@@ -279,16 +279,14 @@ def _get_rule_skips_from_yaml(
yaml_comment_obj_strings.append(str(obj.ca.items))
if isinstance(obj, dict):
for val in obj.values():
- if isinstance(val, (dict, list)):
+ if isinstance(val, dict | list):
traverse_yaml(val)
elif isinstance(obj, list):
for element in obj:
- if isinstance(element, (dict, list)):
+ if isinstance(element, dict | list):
traverse_yaml(element)
- else:
- return
- if isinstance(yaml_input, (dict, list)):
+ if isinstance(yaml_input, dict | list):
traverse_yaml(yaml_input)
rule_id_list = []