Avoid Chained Declarations & Assignments
WarningAnti-Patterns & Bad PracticesQuickFix Ready#EC CHAIN_DECLRemote Enabled
Overview
Avoid chained declarations and chained assignments.
ATC Finding Messages:
Avoid chained declarations; declare each entity individuallyAvoid chained assignments; write separate assignment statements
Rationale
Chained statements pack several definitions behind a colon and commas, so a modifier or type can appear to apply to more than one name. They also turn a one-line change into a large diff and make merge conflicts harder to resolve. Write each declaration or assignment as its own complete statement so scope and modifiers are unambiguous.
Non-Compliant
abap
DATA: lv_order_id TYPE string,
lv_status TYPE string.Compliant
abap
DATA lv_order_id TYPE string.
DATA lv_status TYPE string.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.
Configuration & Thresholds
This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:
| Parameter Name | Data Type | Default Value |
|---|---|---|
ALLOW_STRUCTURE_CHAINS | Boolean | true |
CHECK_CHAINED_DECL | Boolean | true |
CHECK_CHAINED_ASSIGN | Boolean | true |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC CHAIN_DECL
" SAP CI_ prefix format:
... "#EC CI_CHAIN_DECLTechnical Details
- Native ATC Class:
ZCL_SKYLINT_NO_CHAINED_STMT - Implementation File: zcl_skylint_no_chained_stmt.clas.abap