Avoid Redundant Self-Assignments
WarningAnti-Patterns & Bad PracticesQuickFix Ready#EC SELF_ASSIGNRemote Enabled
Overview
Detect Identical Self Assignments.
ATC Finding Message:
Identical assignment has no effect; remove redundant statement
Rationale
Assigning a variable or component to itself does nothing and is usually left over from refactoring or a typo in the source field. It adds noise and can hide a missing assignment. Assign the intended source value or delete the statement.
Non-Compliant
abap
ls_order-customer_id = ls_order-customer_id.Compliant
abap
ls_order-customer_id = iv_customer_id.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 SELF_ASSIGN
" SAP CI_ prefix format:
... "#EC CI_SELF_ASSIGNTechnical Details
- Native ATC Class:
ZCL_SKYLINT_NO_SELF_ASSIGN - Implementation File: zcl_skylint_no_self_assign.clas.abap