From d78d10dd948ed3a0936fbff4188c84b05f17d749 Mon Sep 17 00:00:00 2001 From: GiGaGon <107241144+MeGaGiGaGon@users.noreply.github.com> Date: Tue, 8 Jul 2025 07:00:14 -0700 Subject: [PATCH] [`pycodestyle`] Make example not raise unnecessary `SyntaxError` (`E114`) (#19190) ## Summary Part of #18972 This PR makes [indentation-with-invalid-multiple-comment (E114)](https://docs.astral.sh/ruff/rules/indentation-with-invalid-multiple-comment/#indentation-with-invalid-multiple-comment-e114)'s example not raise a syntax error by adding a 4 space indented `...`. The example still gave `E114` without this, but adding the `...` both makes the change in indentation of the comment clearer, and makes it not give a `SyntaxError`. ## Test Plan N/A, no functionality/tests affected --- .../src/rules/pycodestyle/rules/logical_lines/indentation.rs | 2 ++ scripts/check_docs_formatted.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/indentation.rs b/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/indentation.rs index 380e8ba259..b6a6bbe434 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/indentation.rs +++ b/crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/indentation.rs @@ -60,12 +60,14 @@ impl Violation for IndentationWithInvalidMultiple { /// ```python /// if True: /// # a = 1 +/// ... /// ``` /// /// Use instead: /// ```python /// if True: /// # a = 1 +/// ... /// ``` /// /// ## Formatter compatibility diff --git a/scripts/check_docs_formatted.py b/scripts/check_docs_formatted.py index dc45579ca0..f4ac1b5314 100755 --- a/scripts/check_docs_formatted.py +++ b/scripts/check_docs_formatted.py @@ -57,6 +57,7 @@ KNOWN_FORMATTING_VIOLATIONS = [ "incorrect-blank-line-after-class", "incorrect-blank-line-before-class", "indentation-with-invalid-multiple", + "indentation-with-invalid-multiple-comment", "line-too-long", "missing-trailing-comma", "missing-whitespace", @@ -111,7 +112,6 @@ KNOWN_FORMATTING_VIOLATIONS = [ # For some docs, Ruff is unable to parse the example code. KNOWN_PARSE_ERRORS = [ "blank-line-with-whitespace", - "indentation-with-invalid-multiple-comment", "indented-form-feed", "missing-newline-at-end-of-file", "mixed-spaces-and-tabs",