Skip to content

Commit add4167

Browse files
committed
Update regular file filter
1 parent e1452fc commit add4167

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

codespell_lib/_codespell.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,9 @@ def build_file_list_with_os_walk(
11411141
) -> Iterable[str]:
11421142
all_files = []
11431143
for filename in files:
1144+
# ignore hidden files
1145+
if is_hidden(root, check_hidden):
1146+
continue
11441147
if os.path.isdir(filename):
11451148
for root, dirs, dirfiles in os.walk(filename):
11461149
if glob_match.match(root): # skip (absolute) directories
@@ -1159,6 +1162,14 @@ def build_file_list_with_os_walk(
11591162
if glob_match.match(fname): # skip paths
11601163
continue
11611164
all_files.append(fname)
1165+
1166+
# skip (relative) directories
1167+
dirs[:] = [
1168+
dir_
1169+
for dir_ in dirs
1170+
if not glob_match.match(dir_)
1171+
and not is_hidden(dir_, check_hidden)
1172+
]
11621173
elif not glob_match.match(filename) and not is_hidden(filename, check_hidden):
11631174
all_files.append(filename)
11641175
return all_files

0 commit comments

Comments
 (0)