Limit Type Fan-Out per Procedure
WarningMetrics & Complexity Limits#EC MAX_FANOUTLocal Only
Overview
Limit type fan-out per procedure.
ATC Finding Message:
Procedure depends on too many distinct classes or interfaces
Rationale
A procedure that references many unrelated classes and interfaces is tightly coupled to a large part of the system, which makes it fragile and hard to test in isolation. Counting distinct kind = type references gives a lower-bound fan-out metric that never produces false positives: only types that actually appear in the procedure body are considered. Split responsibilities or introduce a facade when the number grows.
Non-Compliant
abap
DATA lo_a TYPE REF TO zcl_a.
DATA lo_b TYPE REF TO zcl_b.
DATA lo_c TYPE REF TO zcl_c.
DATA lo_d TYPE REF TO zcl_d.Compliant
abap
DATA lo_service TYPE REF TO zif_order_service.
lo_service = mo_service_factory->create( ).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_FANOUT | Integer | 15 | Maximum allowed number of distinct class or interface types per procedure (default: 15) |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC MAX_FANOUT
" SAP CI_ prefix format:
... "#EC CI_MAX_FANOUTRelated Rules
- Limit Class Inheritance Depth (Favor Composition over Inheritance) —
#EC MAX_INHERIT - Limit Class Member Attribute Count (Prevent God Classes) —
#EC MAX_ATTRIBUTES - Limit Method and Constructor Statement Length —
#EC MAX_METHOD_LEN
Technical Details
- Native ATC Class:
ZCL_SKYLINT_MAX_FANOUT - Implementation File: zcl_skylint_max_fanout.clas.abap