-
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
Strangeness with implicit string concatenation, f-strings, and rules F541, RUF027 #11357
Comments
Thank you providing such a detailed set of examples along with the diagnosis! Regarding I've pasted all of the examples in the playground (https://play.ruff.rs/0de4d4a3-bbb3-44bd-b163-2778dba84f64) and I'm seeing the expected behavior for And, I'm seeing the same behavior on the CLI as well: $ ruff check --select RUF027 --preview --isolated src/RUF027.py --output-format=concise
src/RUF027.py:14:5: RUF027 Possible f-string without an `f` prefix
src/RUF027.py:22:5: RUF027 Possible f-string without an `f` prefix
src/RUF027.py:29:5: RUF027 Possible f-string without an `f` prefix
src/RUF027.py:30:5: RUF027 Possible f-string without an `f` prefix
src/RUF027.py:37:5: RUF027 Possible f-string without an `f` prefix
Found 5 errors.
No fixes available (5 hidden fixes can be enabled with the `--unsafe-fixes` option). I'm not sure why you're seeing different behavior for |
F541Ah ok, I didn't realize F541 was expected behavior.:+1:. I plan on making a PR to update the docs https://docs.astral.sh/ruff/rules/f-string-missing-placeholders/ to include something like your comment. Perhaps:
RUF027Strange! Yeah I'll double check. ... Oh son of a b*. My CLI arg was set to RUF029 🤦 Sorry about that! It looks like everything is WAI so I'll close this. Thanks for double checking! |
No worries, thanks for confirming!
Yeah, I think that would be useful |
Addresses this comment: #11357 (comment) ## Summary The docs for F541 did not mention some surprising, but WAI, behavior regarding implicit string concatenation. Update the docs to describe the behavior. Here's how things rendered for me locally: ![image](https://github.com/astral-sh/ruff/assets/5386897/32067121-b190-4268-b987-ff37df11a618)
Summary
Seems like f-string-missing-placeholders (F541) and missing-f-string-syntax (RUF027) don't play nicely with implicit string concatenation.
Examples:
Commands used:
All checks passed!
All checks passed!
All checks passed!
All checks passed!
All checks passed!
All checks passed!
All checks passed!
All checks passed!
All checks passed!
All checks passed!
All checks passed!
All checks passed!
The text was updated successfully, but these errors were encountered: