You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Automated Conversion from Old String Concatenations to String Templates #116
The way we currently concatenate strings is quite inconsistent and therefore not always easily readable. Sometimes we use the old concatenations, and other times we use string templates. How about implementing a rule to automatically convert old string concatenations to string templates?
Great to see, thank you. What does the option "Always convert text literals in concatenations" do exactly? This option isn't represented by the example.
you're right, this option only has an effect if combined with:
It then means: If the concatenation contains a text literal, always put |...| around it, even if nothing is embedded into the string template (because that wouldn't be shorter):
OK, thanks for the explanation! This seems inconsistent to the handling of multi-line string concatenation though. Take a look at the example below. I wouldn't have expected any changes here.
if you use "Embed … if result is shorter" (but NOT equal), then nothing is changed:
So, "Always convert text literals …" really has this notion of "even convert in cases in which the result is not shorter, but equally long" (while unchecking the option does not necessarily prevent text literals from being converted).
Activity
jmgrassau commentedon Sep 30, 2023
Hi Benjamin,
yes, that would indeed be a nice cleanup rule! The idea was already raised in #36 (point 10), but I think this is worth a dedicated issue!
Kind regards,
Jörg-Michael
add new rule "Use string templates to assemble text" (SAP#116)
add new rule "Use string templates to assemble text" (#116)
jmgrassau commentedon Mar 25, 2024
Hi Benjamin,
this idea …
… should be implemented now with the new cleanup rule "Use string templates to assemble text", which was just released as part of version 1.15.0!
However, we could still keep this issue open to check about
CONCATENATE ... INTO ... SEPARATED BY!Kind regards,
Jörg-Michael
ConjuringCoffee commentedon Mar 25, 2024
Great to see, thank you. What does the option "Always convert text literals in concatenations" do exactly? This option isn't represented by the example.
jmgrassau commentedon Mar 25, 2024
Hi ConjuringCoffee,
you're right, this option only has an effect if combined with:
It then means: If the concatenation contains a text literal, always put
|...|around it, even if nothing is embedded into the string template (because that wouldn't be shorter):Kind regards,
Jörg-Michael
ConjuringCoffee commentedon Mar 25, 2024
OK, thanks for the explanation! This seems inconsistent to the handling of multi-line string concatenation though. Take a look at the example below. I wouldn't have expected any changes here.

jmgrassau commentedon Mar 25, 2024
Hi ConjuringCoffee,
if you use "Embed … if result is shorter" (but NOT equal), then nothing is changed:
So, "Always convert text literals …" really has this notion of "even convert in cases in which the result is not shorter, but equally long" (while unchecking the option does not necessarily prevent text literals from being converted).
Kind regards,
Jörg-Michael
jelliottp commentedon Jan 8, 2025
Any updates on expanding this one to include
CONCATENATEstatements? I would find this really valuable as I still run into it on old code.