diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_before_parameters.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_before_parameters.rs index c69145712c..3b0a7b1884 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_before_parameters.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_before_parameters.rs @@ -7,6 +7,25 @@ use ruff_python_parser::token_kind::TokenKind; use crate::checkers::logical_lines::LogicalLinesContext; use crate::rules::pycodestyle::rules::logical_lines::LogicalLine; +/// ## What it does +/// Checks for extraneous whitespace immediately after an open parenthesis +/// or bracket. +/// +/// ## Why is this bad? +/// According to [PEP 8], open parentheses and brackets should not be followed +/// by any trailing whitespace. +/// +/// ## Example +/// ```python +/// spam (1) +/// ``` +/// +/// Use instead: +/// ```python +/// spam(1) +/// ``` +/// +/// [PEP 8]: https://peps.python.org/pep-0008/#pet-peeves #[violation] pub struct WhitespaceBeforeParameters { bracket: TokenKind, diff --git a/scripts/check_docs_formatted.py b/scripts/check_docs_formatted.py index 408158030b..256e2b3394 100755 --- a/scripts/check_docs_formatted.py +++ b/scripts/check_docs_formatted.py @@ -66,6 +66,7 @@ KNOWN_FORMATTING_VIOLATIONS = [ "useless-semicolon", "whitespace-after-open-bracket", "whitespace-before-close-bracket", + "whitespace-before-parameters", "whitespace-before-punctuation", ]