mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 02:20:58 -05:00
parent
edfb79f537
commit
e24c694258
2 changed files with 10 additions and 18 deletions
|
@ -188,7 +188,7 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
|
|||
};
|
||||
|
||||
// Note: file_list and args.path are mutually exclusive, enforced by clap
|
||||
for path in file_list.as_ref().unwrap_or(&args.path) {
|
||||
'path: for path in file_list.as_ref().unwrap_or(&args.path) {
|
||||
// Note paths are passed through stdin, `-` is treated like a normal path
|
||||
let cwd = if path == std::path::Path::new("-") {
|
||||
if args.file_list.is_some() {
|
||||
|
@ -244,8 +244,14 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
|
|||
.build()
|
||||
.with_code(proc_exit::sysexits::CONFIG_ERR)?;
|
||||
if args.force_exclude {
|
||||
if let ignore::Match::Ignore(_) = overrides.matched(path, path.is_dir()) {
|
||||
continue;
|
||||
let mut ancestors = path.ancestors().collect::<Vec<_>>();
|
||||
ancestors.reverse();
|
||||
for path in ancestors {
|
||||
match overrides.matched(path, path.is_dir()) {
|
||||
ignore::Match::None => {}
|
||||
ignore::Match::Ignore(_) => continue 'path,
|
||||
ignore::Match::Whitelist(_) => break,
|
||||
}
|
||||
}
|
||||
}
|
||||
walk.overrides(overrides);
|
||||
|
|
|
@ -1,19 +1,5 @@
|
|||
bin.name = "typos"
|
||||
args = "file.ignore ignore/file parent/ignore/file --force-exclude"
|
||||
stdin = ""
|
||||
stdout = """
|
||||
error: `hello` should be `goodbye`
|
||||
--> ignore/file:1:1
|
||||
|
|
||||
1 | hello
|
||||
| ^^^^^
|
||||
|
|
||||
error: `hello` should be `goodbye`
|
||||
--> parent/ignore/file:1:1
|
||||
|
|
||||
1 | hello
|
||||
| ^^^^^
|
||||
|
|
||||
"""
|
||||
stdout = ""
|
||||
stderr = ""
|
||||
status.code = 2
|
||||
|
|
Loading…
Reference in a new issue