mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:49:50 +00:00
whitespace-before-parameters comment (#6103)
This commit is contained in:
parent
c0dbcb3434
commit
132f07c27b
2 changed files with 20 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -66,6 +66,7 @@ KNOWN_FORMATTING_VIOLATIONS = [
|
|||
"useless-semicolon",
|
||||
"whitespace-after-open-bracket",
|
||||
"whitespace-before-close-bracket",
|
||||
"whitespace-before-parameters",
|
||||
"whitespace-before-punctuation",
|
||||
]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue