[ruff] Add os-path-commonprefix (RUF071)#23814
Conversation
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| RUF071 | 3 | 3 | 0 | 0 | 0 |
ntBre
left a comment
There was a problem hiding this comment.
Thanks, this looks great to me! I just had one suggestion on the diagnostic structure.
Would you be interested in adding a fix too? We could leave that for a follow-up PR, but I think it should be straightforward to autofix this, although I think it will have to be an unsafe fix.
ruff] Add os-path-commonprefix (RUF071)
ruff] Add os-path-commonprefix (RUF071)ruff] Add os-path-commonprefix (RUF071)
Fo sure will do. thank you so much for the review |
Summary
Adds a new rule os-path-commonprefix (RUF071) that detects calls to os.path.commonprefix(), which performs character-by-character string comparison instead of path-component comparison — a well-known footgun. os.path.commonpath() is the correct alternative.
Test Plan
cargo nextest run -p ruff_linter -- rule_ospathcommonprefix
Closes #22981