Avoid Identical Statements in IF Branches
WarningAnti-Patterns & Bad Practices#EC NO_IDENT_CONTRemote Enabled
Overview
Avoid identical code in IF and ELSE branches.
ATC Finding Message:
Identical statement in IF and ELSE branches; extract common code
Rationale
Statements repeated in every branch of an IF/ELSEIF/ELSE carry no branch-specific meaning and duplicate maintenance. If the same statement starts or ends every branch, extract it before or after the IF so it is written once and stays in sync.
Non-Compliant
abap
IF lv_is_active = abap_true.
process( ).
ELSE.
process( ).
ENDIF.Compliant
abap
IF lv_is_active = abap_true.
process_active( ).
ELSE.
process_inactive( ).
ENDIF.Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_IDENT_CONT
" SAP CI_ prefix format:
... "#EC CI_NO_IDENT_CONTTechnical Details
- Native ATC Class:
ZCL_SKYLINT_NO_IDENT_CONT - Implementation File: zcl_skylint_no_ident_cont.clas.abap