From 5c4ed0f833251bc6edd871ffb783f802554d0260 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 17 Feb 2021 16:10:41 +0000 Subject: [PATCH] Avoid reporting runtime errors with unknown file types When loading inline skip-lists we should just ignore files that we do not know how to process. This fixes bug where encountering reno release notes may have cause failure to process noqa on them. --- src/ansiblelint/skip_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ansiblelint/skip_utils.py b/src/ansiblelint/skip_utils.py index d5d793a2186..e8c30110b31 100644 --- a/src/ansiblelint/skip_utils.py +++ b/src/ansiblelint/skip_utils.py @@ -108,10 +108,11 @@ def _append_skipped_rules(pyyaml_data: Sequence[Any], lintable: Lintable) -> Seq # assume it is a playbook, check needs to be added higher in the # call stack, and can remove this except return pyyaml_data - elif lintable.kind in ['yaml', 'requirements', 'vars']: + elif lintable.kind in ['yaml', 'requirements', 'vars', 'meta', 'reno']: return pyyaml_data else: - raise RuntimeError('Unexpected file type: {}'.format(lintable.kind)) + # For unsupported file types, we return empoty skip lists + return [] # get tasks from blocks of tasks pyyaml_tasks = _get_tasks_from_blocks(pyyaml_task_blocks)