From 9929cf416cf457c7f4742242cd6dc9500e149b5e Mon Sep 17 00:00:00 2001 From: Amethyst Reese Date: Tue, 16 Dec 2025 16:30:55 -0800 Subject: [PATCH] Improve documentation for unmatched diagnostic --- .../ruff/rules/unmatched_suppression_comment.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/ruff_linter/src/rules/ruff/rules/unmatched_suppression_comment.rs b/crates/ruff_linter/src/rules/ruff/rules/unmatched_suppression_comment.rs index 2dae90a8c1..818cfd2150 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/unmatched_suppression_comment.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/unmatched_suppression_comment.rs @@ -13,15 +13,24 @@ use crate::Violation; /// ```python /// def foo(): /// ruff: disable[E501] # unmatched -/// ... +/// REALLY_LONG_VALUES = [ +/// ... +/// ] +/// +/// print(REALLY_LONG_VALUE) /// ``` /// /// Use instead: /// ```python /// def foo(): -/// # ruff: disable[E501] /// ... +/// # ruff: disable[E501] +/// REALLY_LONG_VALUES = [ +/// ... +/// ] /// # ruff: enable[E501] +/// +/// print(REALLY_LONG_VALUE) /// ``` /// /// ## References @@ -33,6 +42,6 @@ pub(crate) struct UnmatchedSuppressionComment; impl Violation for UnmatchedSuppressionComment { #[derive_message_formats] fn message(&self) -> String { - "Unmatched suppression comment".to_string() + "Suppression comment without matching `#ruff:enable` comment".to_string() } }