Skip to content

Commit

Permalink
exclude paths with trailing slash (fixes ansible#3524)
Browse files Browse the repository at this point in the history
  • Loading branch information
hille721 committed Jun 1, 2023
1 parent 11d3d18 commit 1836e2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .config/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ black>=22.8.0 # MIT
filelock>=3.3.0 # The Unlicense
jsonschema>=4.10.0 # MIT, version needed for improved errors
packaging>=21.3 # Apache-2.0,BSD-2-Clause
pathspec>=0.9.0 # Mozilla Public License 2.0 (MPL 2.0)
pathspec>=0.10.3 # Mozilla Public License 2.0 (MPL 2.0)
pyyaml>=5.4.1 # MIT (centos 9 has 5.3.1)
rich>=12.0.0 # MIT
ruamel.yaml>=0.17.0,<0.18,!=0.17.29,!=0.17.30 # MIT, next version is planned to have breaking changes
Expand Down
5 changes: 4 additions & 1 deletion src/ansiblelint/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,10 @@ def get_all_files(

def is_excluded(path_to_check: Path) -> bool:
"""Check if a file is exclude by current specs."""
return any(spec.match_file(str(path_to_check)) for spec in pathspecs)
return any(
spec.match_file(pathspec.util.append_dir_sep(path_to_check))
for spec in pathspecs
)

for path in paths:
pathspecs = [
Expand Down

0 comments on commit 1836e2a

Please sign in to comment.