Do multiline string test for W293 too#10049
Merged
MichaReiser merged 1 commit intoastral-sh:mainfrom Feb 19, 2024
Merged
Conversation
Member
|
Nice, thank you |
MichaReiser
approved these changes
Feb 19, 2024
nkxxll
pushed a commit
to nkxxll/ruff
that referenced
this pull request
Mar 10, 2024
dylwil3
pushed a commit
that referenced
this pull request
Jun 19, 2025
Part of #15584 This PR adds fix safety sections to `W291` and `W293` The unsafe caveat was added in #10049 https://github.com/astral-sh/ruff/blob/10a1d9f01e899201c8d37d29071fe68752d09544/crates/ruff_linter/src/rules/pycodestyle/rules/trailing_whitespace.rs#L92 Code example demonstrating unsafety: ``` PS ~\Desktop\New_folder\ruff>Get-Content issue.py ``` ```py # W291 """ 1 """ # W293 """ """ ``` ``` PS ~\Desktop\New_folder\ruff>Get-Escaped-Content issue.py ``` ``` # W291\n"""\n1 \n"""\n\n# W293\n"""\n \n"""\r\n ``` ``` PS ~\Desktop\New_folder\ruff>uvx ruff check issue.py --isolated --select W ``` ```snap issue.py:3:2: W291 Trailing whitespace | 1 | # W291 2 | """ 3 | 1 | ^ W291 4 | """ | = help: Remove trailing whitespace issue.py:8:1: W293 Blank line contains whitespace | 6 | # W293 7 | """ 8 | | ^ W293 9 | """ | = help: Remove whitespace from blank line Found 2 errors. No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option). ``` ## Test Plan <!-- How was it tested? --> N/A, no tests affected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #10038.