Skip to content

Latest commit

 

History

History
51 lines (31 loc) · 1.24 KB

empty-if-branches.md

File metadata and controls

51 lines (31 loc) · 1.24 KB

code pal for ABAP

code pal for ABAP > Documentation > Empty IF Branches Check

Empty IF Branches Check

What is the Intent of the Check?

The Empty IF Branches check searches for empty IF statements and empty IF branches.

Which attributes can be maintained?

Attributes

How to solve the issue?

Fill the IF branch with code, remove it from the code or refactor the condition.

What to do in case of exception?

You can suppress Code Inspector findings generated by this check using the pseudo comment "#EC EMPTY_IF_BRANCH. The pseudo comment has to be placed after the opening statement of the empty IF branch. In case of nested IFstatements, the deepest within the branch.

IF name = ''.
  IF address = ''. "#EC EMPTY_IF_BRANCH

  ENDIF.
ENDIF.

IF name = ''. "#EC EMPTY_IF_BRANCH

ENDIF.

IF name = ''.
  " Source Code.
ELSEIF name = ''. "#EC EMPTY_IF_BRANCH

ELSE.
  " Source Code.
ENDIF.

IF name = ''.
  " Source Code.
ELSE. "#EC EMPTY_IF_BRANCH

ENDIF.

Further Readings & Knowledge