Do Not Ignore Return Value of Functional Methods
WarningAnti-Patterns & Bad Practices#EC NO_IGNORED_RETLocal Only
Overview
Disallow ignoring the return value of functional methods.
ATC Finding Message:
Do not ignore return value of functional method; assign or use result
Rationale
A functional method is called for its RETURNING value, so discarding that value usually means the call is pointless or the method hides side effects. If the method intentionally has side effects, it should not return a value. Assign or consume the result, or refactor the method into a command.
Non-Compliant
abap
lo_calculator->get_total( ).Compliant
abap
lv_total = lo_calculator->get_total( ).Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_IGNORED_RET
" SAP CI_ prefix format:
... "#EC CI_NO_IGNORED_RETTechnical Details
- Native ATC Class:
ZCL_SKYLINT_NO_IGNORED_RETURN - Implementation File: zcl_skylint_no_ignored_return.clas.abap