Ignore directories when collecting files to lint

This commit is contained in:
harupy 2023-07-15 20:17:27 +09:00
parent f029f8b784
commit f0567032d3
1 changed files with 5 additions and 1 deletions

View File

@ -330,9 +330,13 @@ pub fn python_files_in_path(
} }
if result.as_ref().map_or(true, |entry| { if result.as_ref().map_or(true, |entry| {
// Ignore directories
if entry.file_type().map_or(true, |ft| ft.is_dir()) {
return false;
}
if entry.depth() == 0 { if entry.depth() == 0 {
// Accept all files that are passed-in directly. // Accept all files that are passed-in directly.
entry.file_type().map_or(false, |ft| ft.is_file()) true
} else { } else {
// Otherwise, check if the file is included. // Otherwise, check if the file is included.
let path = entry.path(); let path = entry.path();