fix(cli): Allow negative expressions in extend-exclude

Fixes #1099
This commit is contained in:
Ed Page 2024-09-16 13:06:55 -04:00
parent 777cf42dc2
commit d9b55f966c
2 changed files with 12 additions and 4 deletions

View file

@ -244,7 +244,7 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
let mut overrides = ignore::overrides::OverrideBuilder::new("."); let mut overrides = ignore::overrides::OverrideBuilder::new(".");
for pattern in walk_policy.extend_exclude.iter() { for pattern in walk_policy.extend_exclude.iter() {
overrides overrides
.add(&format!("!{pattern}")) .add(pattern)
.with_code(proc_exit::sysexits::CONFIG_ERR)?; .with_code(proc_exit::sysexits::CONFIG_ERR)?;
} }
let overrides = overrides let overrides = overrides
@ -268,8 +268,8 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
log::debug!("match({path:?}, {is_dir}) == {matched:?}"); log::debug!("match({path:?}, {is_dir}) == {matched:?}");
match matched { match matched {
ignore::Match::None => true, ignore::Match::None => true,
ignore::Match::Ignore(_) => false, ignore::Match::Ignore(_) => true,
ignore::Match::Whitelist(_) => true, ignore::Match::Whitelist(_) => false,
} }
}); });
} }

View file

@ -1,4 +1,12 @@
bin.name = "typos" bin.name = "typos"
stdin = "" stdin = ""
stdout = "" stdout = """
error: `hte` should be `the`
--> ./checked/file.txt:1:1
|
1 | hte
| ^^^
|
"""
stderr = "" stderr = ""
status.code = 2