Skip to content

Commit

Permalink
Asure matchtask is runs on supported file kinds
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 6685091
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ansiblelint/rules/__init__.py
Original file line number Diff line number Diff line change
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 6685091

Please sign in to comment.