Avoid Concatenating Adjacent String Literals
NoteAnti-Patterns & Bad PracticesQuickFix Ready#EC NO_USELESS_CONCATRemote Enabled
Overview
Avoid concatenating string literals.
ATC Finding Message:
Fold literal string concatenation into one literal
Rationale
Joining two or more literals with && produces one constant value at runtime, so the operator adds no information and only fragments the text. Folding the literals makes the final string visible and removes a pointless expression. Keep && only when at least one operand is dynamic.
Non-Compliant
abap
lv_path = 'orders' && '/' && 'open'.Compliant
abap
lv_path = 'orders/open'.Automated QuickFix
This rule provides an automated QuickFix directly in Eclipse ABAP Development Tools (ADT):
- Position the cursor on the flagged statement.
- Press Ctrl + 1 (Quick Assist).
- Select the automated refactoring to apply the clean syntax immediately.
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_USELESS_CONCAT
" SAP CI_ prefix format:
... "#EC CI_NO_USELESS_CONCATTechnical Details
- Native ATC Class:
ZCL_SKYLINT_NO_USELESS_CONCAT - Implementation File: zcl_skylint_no_useless_concat.clas.abap