ruff
20d80edf - [`flake8-bugbear`] Mark fix unsafe when it would remove comments (`B033`) (#22632)

Commit
2 days ago
[`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
Author
Parents
Loading