Skip to content

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 statement
  • TRY 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 NameData TypeDefault Value
CHECK_IFBooleantrue
CHECK_LOOPBooleantrue
CHECK_CASEBooleantrue
CHECK_TRYBooleantrue
CHECK_CATCHBooleantrue
CHECK_TRY_NO_CATCHBooleantrue
CHECK_DOBooleantrue
CHECK_WHILEBooleantrue

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_BLOCK

Technical Details ​

Released under the MIT License.