Skip to content

Commit 955e4dd

Browse files
authored
Avoid reporting runtime errors with unknown file types (#1370)
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.
1 parent 0b0b8b5 commit 955e4dd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ansiblelint/skip_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ def _append_skipped_rules(pyyaml_data: Sequence[Any], lintable: Lintable) -> Seq
108108
# assume it is a playbook, check needs to be added higher in the
109109
# call stack, and can remove this except
110110
return pyyaml_data
111-
elif lintable.kind in ['yaml', 'requirements', 'vars']:
111+
elif lintable.kind in ['yaml', 'requirements', 'vars', 'meta', 'reno']:
112112
return pyyaml_data
113113
else:
114-
raise RuntimeError('Unexpected file type: {}'.format(lintable.kind))
114+
# For unsupported file types, we return empty skip lists
115+
return []
115116

116117
# get tasks from blocks of tasks
117118
pyyaml_tasks = _get_tasks_from_blocks(pyyaml_task_blocks)

0 commit comments

Comments
 (0)