From fc7fa59e5fcdef7f83fbf8e6228be434930af66c Mon Sep 17 00:00:00 2001 From: "Peter A. Jonsson" Date: Thu, 28 Mar 2024 00:31:19 +0100 Subject: [PATCH] space_around_operator: use same before/after numbers (#10640) ## Summary The example for tab-after-comma (E242): ```python a = 4,\t5 ``` Use instead: ```python a = 4, 3 ``` is confusing since both the whitespace and the numbers are changed. Change so the examples use the same numbers before/after. ## Test Plan Untested. --- .../rules/logical_lines/space_around_operator.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/space_around_operator.rs b/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/space_around_operator.rs index 94f7cb9e39..0fc9d93ef3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/space_around_operator.rs +++ b/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/space_around_operator.rs @@ -21,7 +21,7 @@ use super::{LogicalLine, Whitespace}; /// /// Use instead: /// ```python -/// a = 12 + 3 +/// a = 4 + 5 /// ``` /// /// [PEP 8]: https://peps.python.org/pep-0008/#whitespace-in-expressions-and-statements @@ -53,7 +53,7 @@ impl AlwaysFixableViolation for TabBeforeOperator { /// /// Use instead: /// ```python -/// a = 12 + 3 +/// a = 4 + 5 /// ``` /// /// [PEP 8]: https://peps.python.org/pep-0008/#whitespace-in-expressions-and-statements @@ -85,7 +85,7 @@ impl AlwaysFixableViolation for MultipleSpacesBeforeOperator { /// /// Use instead: /// ```python -/// a = 12 + 3 +/// a = 4 + 5 /// ``` /// /// [PEP 8]: https://peps.python.org/pep-0008/#whitespace-in-expressions-and-statements @@ -117,7 +117,7 @@ impl AlwaysFixableViolation for TabAfterOperator { /// /// Use instead: /// ```python -/// a = 12 + 3 +/// a = 4 + 5 /// ``` /// /// [PEP 8]: https://peps.python.org/pep-0008/#whitespace-in-expressions-and-statements @@ -148,7 +148,7 @@ impl AlwaysFixableViolation for MultipleSpacesAfterOperator { /// /// Use instead: /// ```python -/// a = 4, 3 +/// a = 4, 5 /// ``` /// #[violation]