mirror of
https://github.com/crate-ci/typos.git
synced 2025-02-02 19:59:34 -05:00
refactor: Clarify roles
This commit is contained in:
parent
1010d2ffe5
commit
e1e4ce8b61
2 changed files with 10 additions and 10 deletions
|
@ -13,7 +13,7 @@ pub trait FileChecker: Send + Sync {
|
|||
path: &std::path::Path,
|
||||
explicit: bool,
|
||||
settings: &CheckSettings,
|
||||
parser: &tokens::Tokenizer,
|
||||
tokenizer: &tokens::Tokenizer,
|
||||
dictionary: &dyn Dictionary,
|
||||
reporter: &dyn report::Report,
|
||||
) -> Result<(), std::io::Error>;
|
||||
|
@ -614,12 +614,12 @@ pub fn walk_path(
|
|||
walk: ignore::Walk,
|
||||
checks: &dyn FileChecker,
|
||||
settings: &CheckSettings,
|
||||
parser: &typos::tokens::Tokenizer,
|
||||
tokenizer: &typos::tokens::Tokenizer,
|
||||
dictionary: &dyn typos::Dictionary,
|
||||
reporter: &dyn report::Report,
|
||||
) -> Result<(), ignore::Error> {
|
||||
for entry in walk {
|
||||
walk_entry(entry, checks, settings, parser, dictionary, reporter)?;
|
||||
walk_entry(entry, checks, settings, tokenizer, dictionary, reporter)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -628,14 +628,14 @@ pub fn walk_path_parallel(
|
|||
walk: ignore::WalkParallel,
|
||||
checks: &dyn FileChecker,
|
||||
settings: &CheckSettings,
|
||||
parser: &typos::tokens::Tokenizer,
|
||||
tokenizer: &typos::tokens::Tokenizer,
|
||||
dictionary: &dyn typos::Dictionary,
|
||||
reporter: &dyn report::Report,
|
||||
) -> Result<(), ignore::Error> {
|
||||
let error: std::sync::Mutex<Result<(), ignore::Error>> = std::sync::Mutex::new(Ok(()));
|
||||
walk.run(|| {
|
||||
Box::new(|entry: Result<ignore::DirEntry, ignore::Error>| {
|
||||
match walk_entry(entry, checks, settings, parser, dictionary, reporter) {
|
||||
match walk_entry(entry, checks, settings, tokenizer, dictionary, reporter) {
|
||||
Ok(()) => ignore::WalkState::Continue,
|
||||
Err(err) => {
|
||||
*error.lock().unwrap() = Err(err);
|
||||
|
@ -652,7 +652,7 @@ fn walk_entry(
|
|||
entry: Result<ignore::DirEntry, ignore::Error>,
|
||||
checks: &dyn FileChecker,
|
||||
settings: &CheckSettings,
|
||||
parser: &typos::tokens::Tokenizer,
|
||||
tokenizer: &typos::tokens::Tokenizer,
|
||||
dictionary: &dyn typos::Dictionary,
|
||||
reporter: &dyn report::Report,
|
||||
) -> Result<(), ignore::Error> {
|
||||
|
@ -670,7 +670,7 @@ fn walk_entry(
|
|||
} else {
|
||||
entry.path()
|
||||
};
|
||||
checks.check_file(path, explicit, settings, parser, dictionary, reporter)?;
|
||||
checks.check_file(path, explicit, settings, tokenizer, dictionary, reporter)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -92,7 +92,7 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
|
|||
};
|
||||
let config = load_config(cwd, &args).with_code(proc_exit::Code::CONFIG_ERR)?;
|
||||
|
||||
let parser = typos::tokens::TokenizerBuilder::new()
|
||||
let tokenizer = typos::tokens::TokenizerBuilder::new()
|
||||
.ignore_hex(config.default.ignore_hex())
|
||||
.leading_digits(config.default.identifier_leading_digits())
|
||||
.leading_chars(config.default.identifier_leading_chars().to_owned())
|
||||
|
@ -151,7 +151,7 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
|
|||
walk.build(),
|
||||
selected_checks,
|
||||
&settings,
|
||||
&parser,
|
||||
&tokenizer,
|
||||
&dictionary,
|
||||
reporter,
|
||||
)
|
||||
|
@ -160,7 +160,7 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
|
|||
walk.build_parallel(),
|
||||
selected_checks,
|
||||
&settings,
|
||||
&parser,
|
||||
&tokenizer,
|
||||
&dictionary,
|
||||
reporter,
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue