Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

RUF046 fix is wrong when a newline appears before a call expression’s opening parenthesis #15263

Closed
dscorbett opened this issue Jan 5, 2025 · 0 comments · Fixed by #15277
Closed
Assignees
Labels
bug Something isn't working fixes Related to suggested fixes for violations help wanted Contributions especially welcome preview Related to preview mode features

Comments

@dscorbett
Copy link

#15230 categorized Subscript and Call as having their own brackets, but because their brackets do not surround the entire expressions, this was not a safe categorization for the purpose of unnecessary-cast-to-int (RUF046). The fix can change program behavior in Ruff 0.8.6.

$ cat ruf046.py
x = int(round
(1))
print(x)

$ python ruf046.py
1

$ ruff check --isolated --preview --select RUF046 ruf046.py --fix
Found 1 error (1 fixed, 0 remaining).

$ cat ruf046.py
x = round
(1)
print(x)

$ python ruf046.py
<built-in function round>
@MichaReiser MichaReiser added bug Something isn't working help wanted Contributions especially welcome labels Jan 5, 2025
@AlexWaygood AlexWaygood added fixes Related to suggested fixes for violations preview Related to preview mode features labels Jan 5, 2025
@dylwil3 dylwil3 self-assigned this Jan 5, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working fixes Related to suggested fixes for violations help wanted Contributions especially welcome preview Related to preview mode features
Projects
None yet
4 participants