Leandro Braga
20d80edfc2
[flake8-bugbear] Mark fix unsafe when it would remove comments (B033) (#22632)
The B033 erroneously removes comments in safe fix.
By running
```console
$ cargo run -p ruff -- check --select B033 - << 'EOF'
{
1,
# comment
1
}
EOF
```
We get:
# Before
```console
B033 [*] Sets should not contain duplicate item `1`
--> -:4:3
|
2 | 1,
3 | # comment
4 | 1
| ^
5 | }
|
help: Remove duplicate item
Found 1 error.
[*] 1 fixable with the `--fix` option.
```
# After
```console
B033 Sets should not contain duplicate item `1`
--> -:4:3
|
2 | 1,
3 | # comment
4 | 1
| ^
5 | }
|
help: Remove duplicate item
Found 1 error.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).
```
Closes #22629
2026-01-16 19:07:19 -05:00
..
2026-01-15 12:53:20 -05:00
2026-01-02 19:58:15 +00:00
2026-01-09 19:27:57 -05:00
2026-01-02 19:58:15 +00:00
2026-01-07 13:55:23 +01:00
2026-01-02 19:58:15 +00:00
2025-12-13 17:56:59 -05:00
2026-01-12 08:59:20 -05:00
2026-01-16 16:17:05 +01:00
2025-06-28 20:24:00 +02:00
2026-01-16 19:07:19 -05:00
2026-01-02 19:58:15 +00:00
2026-01-04 19:54:03 +00:00
2026-01-02 19:58:15 +00:00
2025-08-07 18:21:50 +02:00
2026-01-15 12:35:24 -08:00
2026-01-05 07:55:47 -08:00
2025-12-15 14:29:11 +01:00
2026-01-10 14:56:58 +00:00
2026-01-05 07:55:47 -08:00
2025-12-02 20:10:46 +01:00
2025-12-16 16:33:39 -05:00
2026-01-05 07:55:47 -08:00
2026-01-02 22:10:39 +00:00
2025-12-08 14:00:43 -05:00
2026-01-02 19:58:15 +00:00
2026-01-05 07:55:47 -08:00
2026-01-15 12:35:24 -08:00
2025-12-18 11:38:21 +00:00
2026-01-02 19:58:15 +00:00
2026-01-15 12:35:24 -08:00
2026-01-09 16:28:57 +01:00
2026-01-16 09:23:26 +01:00
2025-12-25 10:06:06 +01:00
2026-01-15 12:31:07 -05:00
2026-01-16 08:42:58 +00:00
2026-01-15 12:31:07 -05:00
2026-01-16 09:23:26 +01:00
2026-01-16 22:09:06 +00:00
2026-01-13 08:13:11 +00:00
2026-01-16 15:02:47 +01:00
2026-01-02 19:58:15 +00:00
2026-01-13 14:56:56 +00:00
2026-01-15 12:37:30 +00:00
2026-01-15 08:44:54 +00:00