From 668509119f28d32ae7f6ca2f08a81251d72dfcd5 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Thu, 18 Mar 2021 15:39:02 +0000 Subject: [PATCH] Asure matchtask is runs on supported file kinds Fixes bug where matchtasks() was called for file kinds that may not be containers for task. Fixes: #1368 --- src/ansiblelint/rules/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansiblelint/rules/__init__.py b/src/ansiblelint/rules/__init__.py index 1d7bf22794..56c08cc2cd 100644 --- a/src/ansiblelint/rules/__init__.py +++ b/src/ansiblelint/rules/__init__.py @@ -89,7 +89,7 @@ def matchlines(self, file: "Lintable") -> List[MatchError]: # https://github.com/ansible-community/ansible-lint/issues/744 def matchtasks(self, file: Lintable) -> List[MatchError]: matches: List[MatchError] = [] - if not self.matchtask or file.kind == 'meta': + if not self.matchtask or file.kind not in ['handlers', 'tasks', 'playbook']: return matches yaml = ansiblelint.utils.parse_yaml_linenumbers(file)