From 73eb86d0f53d9a2c3f7ef0a4766e68980ef56fc8 Mon Sep 17 00:00:00 2001 From: Brent Westbrook Date: Fri, 26 Sep 2025 17:18:39 -0400 Subject: [PATCH] DiagnosticId::RangeFormatNotebook -> InvalidCliOption --- crates/ruff/src/commands/format.rs | 4 ++-- crates/ruff_db/src/diagnostic/mod.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/ruff/src/commands/format.rs b/crates/ruff/src/commands/format.rs index 8bc4dfa8a7..55f9b5568c 100644 --- a/crates/ruff/src/commands/format.rs +++ b/crates/ruff/src/commands/format.rs @@ -924,7 +924,7 @@ impl From<&FormatCommandError> for Diagnostic { } }, FormatCommandError::RangeFormatNotebook(_) => Diagnostic::new( - DiagnosticId::RangeFormatNotebook, + DiagnosticId::InvalidCliOption, Severity::Error, "Range formatting isn't supported for notebooks.", ), @@ -1314,7 +1314,7 @@ mod tests { io: Cannot write to file --> test.py:1:1 - range-format-notebook: Range formatting isn't supported for notebooks. + invalid-cli-option: Range formatting isn't supported for notebooks. --> test.py:1:1 panic: Panicked at when checking `test.py`: `Test panic for FormatCommandError` diff --git a/crates/ruff_db/src/diagnostic/mod.rs b/crates/ruff_db/src/diagnostic/mod.rs index 1eab12d036..9039c8e6e8 100644 --- a/crates/ruff_db/src/diagnostic/mod.rs +++ b/crates/ruff_db/src/diagnostic/mod.rs @@ -445,7 +445,7 @@ impl Diagnostic { | DiagnosticId::UselessOverridesSection | DiagnosticId::DeprecatedSetting | DiagnosticId::Unformatted - | DiagnosticId::RangeFormatNotebook + | DiagnosticId::InvalidCliOption | DiagnosticId::FormatError => None, DiagnosticId::Lint(lint_name) => { Some(format!("{}/rules/{lint_name}", env!("CARGO_PKG_HOMEPAGE"))) @@ -1036,8 +1036,8 @@ pub enum DiagnosticId { /// The code needs to be formatted. Unformatted, - /// Range formatting isn't supported for notebooks. - RangeFormatNotebook, + /// Use of an invalid command-line option. + InvalidCliOption, /// Something went wrong while formatting. /// @@ -1083,7 +1083,7 @@ impl DiagnosticId { DiagnosticId::UselessOverridesSection => "useless-overrides-section", DiagnosticId::DeprecatedSetting => "deprecated-setting", DiagnosticId::Unformatted => "unformatted", - DiagnosticId::RangeFormatNotebook => "range-format-notebook", + DiagnosticId::InvalidCliOption => "invalid-cli-option", DiagnosticId::FormatError => "format-error", } }