diff --git a/crates/ruff_linter/src/rules/pycodestyle/rules/doc_line_too_long.rs b/crates/ruff_linter/src/rules/pycodestyle/rules/doc_line_too_long.rs index 50a41f4f1b6ad..99c7ba07030d4 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/rules/doc_line_too_long.rs +++ b/crates/ruff_linter/src/rules/pycodestyle/rules/doc_line_too_long.rs @@ -51,6 +51,19 @@ use crate::settings::LinterSettings; /// """ /// ``` /// +/// ## Error suppression +/// Hint: when suppressing `W505` errors within multi-line strings (like +/// docstrings), the `noqa` directive should come at the end of the string +/// (after the closing triple quote), and will apply to the entire string, like +/// so: +/// +/// ```python +/// """Lorem ipsum dolor sit amet. +/// +/// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. +/// """ # noqa: W505 +/// ``` +/// /// ## Options /// - `task-tags` /// - `pycodestyle.max-doc-length` diff --git a/crates/ruff_linter/src/rules/pycodestyle/rules/line_too_long.rs b/crates/ruff_linter/src/rules/pycodestyle/rules/line_too_long.rs index d803cfa559149..8161ebb753a84 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/rules/line_too_long.rs +++ b/crates/ruff_linter/src/rules/pycodestyle/rules/line_too_long.rs @@ -45,11 +45,24 @@ use crate::settings::LinterSettings; /// ) /// ``` /// +/// ## Error suppression +/// Hint: when suppressing `E501` errors within multi-line strings (like +/// docstrings), the `noqa` directive should come at the end of the string +/// (after the closing triple quote), and will apply to the entire string, like +/// so: +/// +/// ```python +/// """Lorem ipsum dolor sit amet. +/// +/// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. +/// """ # noqa: E501 +/// ``` +/// /// ## Options /// - `line-length` -/// - `pycodestyle.max-line-length` /// - `task-tags` /// - `pycodestyle.ignore-overlong-task-comments` +/// - `pycodestyle.max-line-length` /// /// [PEP 8]: https://peps.python.org/pep-0008/#maximum-line-length #[violation]