mirror of
https://github.com/crate-ci/typos.git
synced 2025-02-13 08:40:29 -05:00
fix(cli): Report more errors through report system
This commit is contained in:
parent
104ebdcb6b
commit
c927717f2d
1 changed files with 7 additions and 2 deletions
|
@ -696,10 +696,15 @@ fn walk_entry(
|
||||||
let explicit = entry.depth() == 0;
|
let explicit = entry.depth() == 0;
|
||||||
let (path, lookup_path) = if entry.is_stdin() {
|
let (path, lookup_path) = if entry.is_stdin() {
|
||||||
let path = std::path::Path::new("-");
|
let path = std::path::Path::new("-");
|
||||||
(path, std::env::current_dir()?)
|
let cwd = std::env::current_dir().map_err(|err| {
|
||||||
|
let kind = err.kind();
|
||||||
|
std::io::Error::new(kind, "no current working directory".to_owned())
|
||||||
|
})?;
|
||||||
|
(path, cwd)
|
||||||
} else {
|
} else {
|
||||||
let path = entry.path();
|
let path = entry.path();
|
||||||
(path, path.canonicalize()?)
|
let abs_path = report_result(path.canonicalize(), Some(path), reporter)?;
|
||||||
|
(path, abs_path)
|
||||||
};
|
};
|
||||||
let policy = engine.policy(&lookup_path);
|
let policy = engine.policy(&lookup_path);
|
||||||
checks.check_file(path, explicit, &policy, reporter)?;
|
checks.check_file(path, explicit, &policy, reporter)?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue