Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error suppression hint for multi-line strings #9205

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
15 changes: 14 additions & 1 deletion crates/ruff_linter/src/rules/pycodestyle/rules/line_too_long.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤣

///
/// [PEP 8]: https://peps.python.org/pep-0008/#maximum-line-length
#[violation]
Expand Down
Loading