mirror of https://github.com/astral-sh/ruff
Disable panic hook about reporting issues for debug builds
In order to avoid confusing new developers. When a debug build panics chances are that the panic is caused by local changes and should in fact not be reported on GitHub.
This commit is contained in:
parent
cd3d82213a
commit
39d98d3488
|
|
@ -58,20 +58,23 @@ fn inner_main() -> Result<ExitCode> {
|
||||||
log_level_args,
|
log_level_args,
|
||||||
} = Args::parse_from(args);
|
} = Args::parse_from(args);
|
||||||
|
|
||||||
let default_panic_hook = std::panic::take_hook();
|
#[cfg(not(debug_assertions))]
|
||||||
std::panic::set_hook(Box::new(move |info| {
|
{
|
||||||
eprintln!(
|
let default_panic_hook = std::panic::take_hook();
|
||||||
r#"
|
std::panic::set_hook(Box::new(move |info| {
|
||||||
|
eprintln!(
|
||||||
|
r#"
|
||||||
{}: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:
|
{}: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:
|
||||||
|
|
||||||
https://github.com/charliermarsh/ruff/issues/new?title=%5BPanic%5D
|
https://github.com/charliermarsh/ruff/issues/new?title=%5BPanic%5D
|
||||||
|
|
||||||
quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!
|
quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!
|
||||||
"#,
|
"#,
|
||||||
"error".red().bold(),
|
"error".red().bold(),
|
||||||
);
|
);
|
||||||
default_panic_hook(info);
|
default_panic_hook(info);
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
let log_level: LogLevel = (&log_level_args).into();
|
let log_level: LogLevel = (&log_level_args).into();
|
||||||
set_up_logging(&log_level)?;
|
set_up_logging(&log_level)?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue