From 777cf42dc2d133b4dd91f2ec52cdd7347f9c3d74 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 16 Sep 2024 13:46:30 -0500 Subject: [PATCH] refactor(cli): Be explicit in overrides --- crates/typos-cli/src/bin/typos-cli/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/typos-cli/src/bin/typos-cli/main.rs b/crates/typos-cli/src/bin/typos-cli/main.rs index ca0638a..f0ba487 100644 --- a/crates/typos-cli/src/bin/typos-cli/main.rs +++ b/crates/typos-cli/src/bin/typos-cli/main.rs @@ -261,7 +261,17 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult { } } } - walk.overrides(overrides); + walk.filter_entry(move |entry| { + let path = entry.path(); + let is_dir = entry.file_type().map(|t| t.is_dir()).unwrap_or(false); + let matched = overrides.matched(path, is_dir); + log::debug!("match({path:?}, {is_dir}) == {matched:?}"); + match matched { + ignore::Match::None => true, + ignore::Match::Ignore(_) => false, + ignore::Match::Whitelist(_) => true, + } + }); } // HACK: Diff doesn't handle mixing content