Skip to content

Commit

Permalink
Asure matchtask is runs on supported file kinds (#1474)
Browse files Browse the repository at this point in the history
Fixes bug where matchtasks() was called for file kinds that may
not be containers for task.

Fixes: #1368
  • Loading branch information
ssbarnea committed Mar 18, 2021
1 parent 4d1a572 commit c6e3d53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ansiblelint/rules/__init__.py
Expand Up @@ -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)
Expand Down

0 comments on commit c6e3d53

Please sign in to comment.