-
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
Allow (formatter?) config to never introduce implicitly concatenated strings or just accept that a check run will complain about it #14638
Comments
I think what you're asking for will be addressed with the upcoming Ruff 2025 style guide (#13371). The relevant changes are:
These two changes will make the formatter compatible with ISC001 (also see #8272). |
This might be a bug but I'm not sure if it's still worth fixing considering that the new style guide will be released shortly. But feel free to submit a PR that suppresses the warning if that setting is set. |
This is actually something I don't want: up to now, all such cases of mine were bad coding from my side and in a lot of cases I had to pick a comma instead of a plus. Just merging the strings will mean that |
I see. So the problem here is that you introduce implicit concatenated strings and you want the formatter to leave them unchanged? I don't think we should introduce an option for this because it is in direct conflict with consistent formatting. However, I do see how the formatter joining the strings can be "annoying" in an editor context. IMO, the benefit of the formatter joining the strings is that it becomes very apparent that you forgot a
The formatter never introduces implicit concatenated strings. It only formats implicit concatenated strings that were already present in the source. |
I think implicitly concat'ed strings are pure evil since a time where I had to debug an accidentally added comma in a place where
+
would have been proper, which made a single string a tuple of two strings. I would like ruff to allow one to configure that "no explicit string concat, and not fix it such a way, ever" and not complain about such a config, but currently it does complain and IMO it complains for the wrong reasons and with the wrong solution:I don't want it to stop complaining about implicitly concat'ed strings, but stop the formatter from introducing them by using a '+' between multiline strings. Or if the formatter needs to introduce implicitly concat'ed strings (because + would be a black violation), just let
ruff check
complain (when it happens), so I'm forced to fix it by hand (which I would be fine with). But having the scary warning in all runs makes me and especially unwary users scared into disabling that rule. :-(Inspired by #13031 (comment), I would have expected that
would work, but ruff still complains, that this is incompatible with the formatter:
The text was updated successfully, but these errors were encountered: