whitespace-before-parameters comment (#6103)

This commit is contained in:
rembridge 2023-07-27 00:01:47 +01:00 committed by GitHub
parent c0dbcb3434
commit 132f07c27b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -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,

View file

@ -66,6 +66,7 @@ KNOWN_FORMATTING_VIOLATIONS = [
"useless-semicolon",
"whitespace-after-open-bracket",
"whitespace-before-close-bracket",
"whitespace-before-parameters",
"whitespace-before-punctuation",
]