diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_named_parameter_equals.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_named_parameter_equals.rs index 0a0d4adc62dbdf..3d0c07ab0aeecc 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_named_parameter_equals.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_named_parameter_equals.rs @@ -8,10 +8,15 @@ use crate::checkers::logical_lines::LogicalLinesContext; use crate::rules::pycodestyle::rules::logical_lines::{LogicalLine, LogicalLineToken}; /// ## What it does -/// Checks for unexpected spaces around keyword / parameter equals. +/// Checks for unexpected spaces around the equals sign in a keyword argument. /// /// ## Why is this bad? -/// Unexpected spaces around keyword / parameter equals makes the code harder to read. +/// According to [PEP 8], there should be no spaces around the equals sign in a +/// keyword argument: +/// +/// > Don’t use spaces around the = sign when used to indicate a keyword +/// > argument, or when used to indicate a default value for an unannotated +/// > function parameter. /// /// ## Example /// ```python @@ -30,6 +35,8 @@ use crate::rules::pycodestyle::rules::logical_lines::{LogicalLine, LogicalLineTo /// /// foo(bar=1) /// ``` +/// +/// [PEP 8]: https://peps.python.org/pep-0008/#whitespace-in-expressions-and-statements #[violation] pub struct UnexpectedSpacesAroundKeywordParameterEquals; @@ -44,7 +51,12 @@ impl Violation for UnexpectedSpacesAroundKeywordParameterEquals { /// Checks for missing whitespace around parameter equals. /// /// ## Why is this bad? -/// Missing whitespace around parameter equals makes the code harder to read. +/// According to [PEP 8], there should be no spaces around the equals sign in a +/// keyword argument: +/// +/// > Don’t use spaces around the = sign when used to indicate a keyword +/// > argument, or when used to indicate a default value for an unannotated +/// > function parameter. /// /// ## Example /// ```python