Omit Unnecessary RETURN Statement
WarningAnti-Patterns & Bad PracticesQuickFix Ready#EC NO_UNNEC_RETURNRemote Enabled
Overview
Omit unnecessary RETURN at end of routine.
ATC Finding Message:
Omit optional RETURN at end of routine; routines return automatically
Rationale
A RETURN as the final statement of a method, form, or function changes nothing because the routine ends at ENDMETHOD, ENDFORM, or ENDFUNCTION anyway. It adds a line that implies a special exit and can obscure the real control flow. Remove trailing RETURN statements and keep early returns only where they are meaningful.
Non-Compliant
abap
METHOD get_total.
rv_total = lv_subtotal + lv_tax.
RETURN.
ENDMETHOD.Compliant
abap
METHOD get_total.
rv_total = lv_subtotal + lv_tax.
ENDMETHOD.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 NO_UNNEC_RETURN
" SAP CI_ prefix format:
... "#EC CI_NO_UNNEC_RETURNTechnical Details
- Native ATC Class:
ZCL_SKYLINT_NO_UNNEC_RETURN - Implementation File: zcl_skylint_no_unnec_return.clas.abap