[flake8-bugbear] Add fix for duplicate-value (B033)#9510
[flake8-bugbear] Add fix for duplicate-value (B033)#9510charliermarsh merged 6 commits intoastral-sh:mainfrom
flake8-bugbear] Add fix for duplicate-value (B033)#9510Conversation
58e9888 to
d07dcbb
Compare
CodSpeed Performance ReportMerging #9510 will not alter performanceComparing Summary
|
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PLC0415 | 14 | 14 | 0 | 0 | 0 |
| PLR0917 | 8 | 8 | 0 | 0 | 0 |
| PLR6201 | 6 | 6 | 0 | 0 | 0 |
| B033 | 2 | 0 | 0 | 2 | 0 |
| PLR0904 | 1 | 1 | 0 | 0 | 0 |
| F841 | 1 | 1 | 0 | 0 | 0 |
| E721 | 1 | 1 | 0 | 0 | 0 |
| PLR0914 | 1 | 1 | 0 | 0 | 0 |
ac694f5 to
ec40f0a
Compare
ec40f0a to
b574c93
Compare
| range: TextRange::default(), | ||
| })), | ||
| range, | ||
| )); |
There was a problem hiding this comment.
I would prefer to do something similar to remove_argument, if possible, since the generator-based approach will lose comments. Are you open to trying that?
There was a problem hiding this comment.
Seems like remove_argument is strictly for ExprCalls and associated Arguments, unsure if it'd work to cast everything over.
All usages of remove_argument come from actual ExprCalls, and we're working with a vector of Expr here from a set.
Please advise! 🙏🏽
There was a problem hiding this comment.
Oh sorry, I meant, like, writing a new method that removes an element from a comma-separated collections, but based on the token stream, similar to remove_argument.
There was a problem hiding this comment.
Ahh. I'll see what I can do!
|
Tweaked accordingly. The new function is not special to this set implementation, and could be placed into the I feel like this rule could also be expanded to work on |
0821654 to
260ad1d
Compare
B033flake8-bugbear] Add fix for duplicate-value (B033)
|
Woop, left dead code in there facepalm Thanks Charlie! |
|
No it's all good, I just realized that with the revised fix implementation, we could revert back to the previous structure! |
|
Had to move this under preview since we're not supposed to add safe fixes outside of preview (this is gonna change in the next minor release though, and we'll elevate this out of preview). |
Summary
Adds autofix for B033
Test Plan
cargo test