[ruff] Add unsafe fix for os-path-commonprefix (RUF071)#23852
[ruff] Add unsafe fix for os-path-commonprefix (RUF071)#23852amyreese merged 3 commits intoastral-sh:mainfrom
ruff] Add unsafe fix for os-path-commonprefix (RUF071)#23852Conversation
|
|
Thank you so much for the feedback @ntBre @amyreese! I've updated the PR:
I tried a simpler text replacement to preserve the user's import style, but that breaks the from os.path import commonprefix case; the call becomes commonpath(...) with no matching import. Went with the get_or_import_symbol approach instead. I would like to request your re-review whenever you get a chance. Thank you |
ntBre
left a comment
There was a problem hiding this comment.
LGTM!
I'm still slightly disappointed that we can't preserve the import style, but that seems like a general issue with get_or_import_symbol and doesn't need to block this PR! Using manual range replacements to achieve that effect seems much worse.
Summary
Adds an unsafe autofix for RUF071 (os-path-commonprefix) that replaces os.path.commonprefix() calls with os.path.commonpath().
Test Plan