Avoid Empty Control Blocks
WarningAnti-Patterns & Bad Practices#EC EMPTY_BLOCKRemote Enabled
Overview
Avoid empty control blocks (IF, CASE, LOOP, TRY, etc.).
ATC Finding Messages:
Empty control block detected; remove redundant control statementTRY block without CATCH is superfluous
Rationale
An empty branch usually signals unfinished logic, forgotten code, or an inverted condition. Readers must search for hidden behavior and may assume the branch does something. Restructure the condition so every branch has a purpose, or remove the empty block entirely.
Non-Compliant
abap
IF lv_is_active = abap_true.
" no processing yet
ELSE.
process( ).
ENDIF.Compliant
abap
IF NOT lv_is_active.
process( ).
ENDIF.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 |
|---|---|---|
CHECK_IF | Boolean | true |
CHECK_LOOP | Boolean | true |
CHECK_CASE | Boolean | true |
CHECK_TRY | Boolean | true |
CHECK_CATCH | Boolean | true |
CHECK_TRY_NO_CATCH | Boolean | true |
CHECK_DO | Boolean | true |
CHECK_WHILE | Boolean | true |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC EMPTY_BLOCK
" SAP CI_ prefix format:
... "#EC CI_EMPTY_BLOCKTechnical Details
- Native ATC Class:
ZCL_SKYLINT_NO_EMPTY_BLOCK - Implementation File: zcl_skylint_no_empty_block.clas.abap