mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
Collect result in format CLI (#6924)
This commit is contained in:
parent
292fdd978e
commit
a871714705
1 changed files with 9 additions and 12 deletions
|
@ -32,7 +32,7 @@ pub(crate) fn format(cli: &Arguments, overrides: &Overrides) -> Result<ExitStatu
|
||||||
return Ok(ExitStatus::Success);
|
return Ok(ExitStatus::Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
let all_success = paths
|
let result = paths
|
||||||
.into_par_iter()
|
.into_par_iter()
|
||||||
.map(|dir_entry| {
|
.map(|dir_entry| {
|
||||||
let dir_entry = dir_entry?;
|
let dir_entry = dir_entry?;
|
||||||
|
@ -57,21 +57,18 @@ pub(crate) fn format(cli: &Arguments, overrides: &Overrides) -> Result<ExitStatu
|
||||||
format_path(path, options)
|
format_path(path, options)
|
||||||
})
|
})
|
||||||
.map(|result| {
|
.map(|result| {
|
||||||
match result {
|
if let Err(err) = result.as_ref() {
|
||||||
Ok(()) => true,
|
|
||||||
Err(err) => {
|
|
||||||
// The inner errors are all flat, i.e., none of them has a source.
|
// The inner errors are all flat, i.e., none of them has a source.
|
||||||
#[allow(clippy::print_stderr)]
|
#[allow(clippy::print_stderr)]
|
||||||
{
|
{
|
||||||
eprintln!("{}", err.to_string().red().bold());
|
eprintln!("{}", err.to_string().red().bold());
|
||||||
}
|
}
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
result
|
||||||
})
|
})
|
||||||
.all(|success| success);
|
.collect::<Result<Vec<_>, _>>();
|
||||||
|
|
||||||
if all_success {
|
if result.is_ok() {
|
||||||
Ok(ExitStatus::Success)
|
Ok(ExitStatus::Success)
|
||||||
} else {
|
} else {
|
||||||
Ok(ExitStatus::Error)
|
Ok(ExitStatus::Error)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue