GiGaGon
440635cbe6
[pycodestyle] Add fix safety section to W291 and W293 (#18800)
Part of #15584
This PR adds fix safety sections to `W291` and `W293`
The unsafe caveat was added in #10049
10a1d9f01e/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.
2025-06-19 16:48:02 -05:00
..
2025-06-19 09:37:58 -04:00
2025-05-16 13:25:28 +02:00
2025-06-18 13:41:38 +02:00
2025-05-16 13:25:28 +02:00
2025-06-18 13:41:38 +02:00
2025-06-05 12:48:29 -04:00
2025-05-28 09:27:09 -04:00
2025-05-16 13:25:28 +02:00
2025-06-15 14:27:39 +01:00
2025-05-16 13:25:28 +02:00
2025-06-19 16:48:02 -05:00
2025-06-19 09:37:58 -04:00
2025-05-16 13:25:28 +02:00
2025-06-13 08:40:11 -04:00
2025-06-13 08:40:11 -04:00
2025-06-13 08:40:11 -04:00
2025-06-18 14:56:15 +02:00
2025-05-16 13:25:28 +02:00
2025-05-16 13:25:28 +02:00
2025-06-18 14:56:15 +02:00
2025-05-16 13:25:28 +02:00
2025-06-19 16:23:46 -05:00
2025-05-16 13:25:28 +02:00
2025-06-07 16:02:43 +02:00
2025-05-16 13:25:28 +02:00
2025-06-19 09:37:58 -04:00
2025-05-16 13:25:28 +02:00
2025-05-19 11:40:58 -04:00
2025-06-19 09:37:58 -04:00
2025-06-19 09:37:58 -04:00
2025-06-18 08:57:36 +00:00
2025-06-17 09:24:28 +02:00
2025-06-18 13:41:38 +02:00
2025-06-17 18:02:40 +01:00
2025-06-17 13:50:45 +05:30
2025-06-15 14:27:39 +01:00
2025-06-15 10:20:33 +01:00
2025-06-05 11:43:18 -04:00