From 36276143be1925f0129a54bca3d34c86737a19be Mon Sep 17 00:00:00 2001 From: GiGaGon <107241144+MeGaGiGaGon@users.noreply.github.com> Date: Tue, 8 Jul 2025 06:58:04 -0700 Subject: [PATCH] [`pycodestyle`] Make example error out-of-the-box (`E272`) (#19191) ## Summary Part of #18972 This PR makes [multiple-spaces-before-keyword (E272)](https://docs.astral.sh/ruff/rules/multiple-spaces-before-keyword/#multiple-spaces-before-keyword-e272)'s example error out-of-the-box. Since `True` is also a keyword, the old example raises `E271` instead. [Old example](https://play.ruff.rs/23ec3774-5038-471c-be3f-1c1e36f85cbb) ```py True and False ``` [New example](https://play.ruff.rs/d77432e2-fd99-4db2-9cd0-bc08675c0aca) ```py x and y ``` The "Use instead" section was also updated similarly. ## Test Plan N/A, no functionality/tests affected --- .../rules/logical_lines/whitespace_around_keywords.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs b/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs index 48b87acda7..af7a415275 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs +++ b/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs @@ -43,12 +43,12 @@ impl AlwaysFixableViolation for MultipleSpacesAfterKeyword { /// /// ## Example /// ```python -/// True and False +/// x and y /// ``` /// /// Use instead: /// ```python -/// True and False +/// x and y /// ``` #[derive(ViolationMetadata)] pub(crate) struct MultipleSpacesBeforeKeyword;