Skip to content

Commit

Permalink
Fix exclude logic bug that can cause cause partial linting (#3552)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Jun 13, 2023
1 parent 0104128 commit 03a5a71
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/ansiblelint/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def worker(lintable: Lintable) -> list[MatchError]:
for data in return_list:
matches.extend(data)

matches = self._filter_excluded_matches(matches)
# -- phase 2 ---
if not matches:
# do our processing only when ansible syntax check passed in order
Expand Down Expand Up @@ -256,17 +257,18 @@ def worker(lintable: Lintable) -> list[MatchError]:
self.checked_files.update(self.lintables)

# remove any matches made inside excluded files
matches = list(
filter(
lambda match: not self.is_excluded(match.lintable)
and hasattr(match, "lintable")
and match.tag not in match.lintable.line_skips[match.lineno],
matches,
),
)
matches = self._filter_excluded_matches(matches)

return sorted(set(matches))

def _filter_excluded_matches(self, matches: list[MatchError]) -> list[MatchError]:
return [
match
for match in matches
if not self.is_excluded(match.lintable)
and match.tag not in match.lintable.line_skips[match.lineno]
]

def _emit_matches(self, files: list[Lintable]) -> Generator[MatchError, None, None]:
visited: set[Lintable] = set()
while visited != self.lintables:
Expand Down

0 comments on commit 03a5a71

Please sign in to comment.