diff --git a/crates/ruff/src/resolver.rs b/crates/ruff/src/resolver.rs index 0ad0fa244ed86..ccbd7ecc31092 100644 --- a/crates/ruff/src/resolver.rs +++ b/crates/ruff/src/resolver.rs @@ -330,9 +330,12 @@ pub fn python_files_in_path( } if result.as_ref().map_or(true, |entry| { - if entry.depth() == 0 { + // Ignore directories + if entry.file_type().map_or(true, |ft| ft.is_dir()) { + false + } else if entry.depth() == 0 { // Accept all files that are passed-in directly. - entry.file_type().map_or(false, |ft| ft.is_file()) + true } else { // Otherwise, check if the file is included. let path = entry.path();