Improve documentation for unmatched diagnostic

This commit is contained in:
Amethyst Reese 2025-12-16 16:30:55 -08:00
parent 005fa7f7f0
commit 9929cf416c
1 changed files with 12 additions and 3 deletions

View File

@ -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()
}
}