Avoid Excessive Method Chaining
WarningClean ABAP & Modern Syntax#EC NO_METHOD_CHAINRemote Enabled
Overview
Avoid excessive method chaining; extract into variables.
ATC Finding Message:
Excessive method chaining; extract intermediate results into variables
Rationale
Chaining multiple method calls together degrades readability and makes debugging difficult. Extract intermediate results into explanatory local variables.
Non-Compliant
abap
lo_demo->meth1( )->meth2( ).Compliant
abap
DATA(lo_step) = lo_demo->meth1( ).
lo_step->meth2( ).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 | Description & Guidance |
|---|---|---|---|
MAX_CHAIN | Integer | 1 | Maximum allowed chained calls (defaults to 1) |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_METHOD_CHAIN
" SAP CI_ prefix format:
... "#EC CI_NO_METHOD_CHAINRelated Rules
- Avoid Obsolete CALL METHOD —
#EC NO_CALL_METHOD - Limit Method and Constructor Statement Length —
#EC MAX_METHOD_LEN
Technical Details
- Native ATC Class:
ZCL_SKYLINT_NO_METHOD_CHAIN - Implementation File: zcl_skylint_no_method_chain.clas.abap