-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
query: UP032 fix leaves bad formatting? #8683
Comments
Fix formatting is very much a best-effort thing, but we can definitely try to improve these. (I might argue that the first one had strange formatting before the fix too :)) |
Definitely 😆 I don't know how much code is formatted like this in the wider world but there are quite a few cases of this in scipy/scipy#19516 |
Indeed and I am responsible for a few of those. But in our defense, the reasoning is the PEP8 80 chars line limit olympics. We can live with the 2nd example though not really a big deal. |
It'd be nice to detect-and-strip trailing empty strings and trailing newlines. |
## Summary When converting from a `.format` call to an f-string, we can trim any trailing empty tokens. Closes #8683.
Hopefully better in the next release! At least, the two examples above are fixed by #8712. |
@charliermarsh thank you for the rapid action. Much appreciated. |
noted by @ilayn scipy/scipy#19516 (comment)
version: ruff 0.1.5
UP032 fix seems to leave some undesired formatting. In the case of SciPy where we want to run the linter without a formatter, this is less than ideal. Is this the intended behaviour, or could it be improved? Examples:
The text was updated successfully, but these errors were encountered: