Hide unsafe fix suggestions when explicitly disabled (#9095)

Hides hints about unsafe fixes when they are disabled e.g. with
`--no-unsafe-fixes` or `unsafe-fixes = false`. By default, unsafe fix
hints are still displayed. This seems like a nice way to remove the nag
for users who have chosen not to apply unsafe fixes.

Inspired by comment at
https://github.com/astral-sh/ruff/issues/9063#issuecomment-1850289675
This commit is contained in:
Zanie Blue 2023-12-11 15:42:53 -06:00 committed by GitHub
parent 2993c342d2
commit 8e9bf84047
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 62 additions and 14 deletions

View file

@ -93,8 +93,10 @@ pub struct Options {
pub fix: Option<bool>,
/// Enable application of unsafe fixes.
/// If excluded, a hint will be displayed when unsafe fixes are available.
/// If set to false, the hint will be hidden.
#[option(
default = "false",
default = r#"null"#,
value_type = "bool",
example = "unsafe-fixes = true"
)]