Skip to content

Latest commit

 

History

History
40 lines (24 loc) · 1.35 KB

boolean-input-parameter.md

File metadata and controls

40 lines (24 loc) · 1.35 KB

code pal for ABAP > Documentation > Boolean Input Parameter

Boolean Input Parameter

What is the intent of the check?

This check searches for boolean input parameters in method signatures. These parameters could be an indicator that the single-responsibility principle (SRP) is not followed since the method might be doing several things at once.

Setter methods using boolean input variables are acceptable when the variable being set is a boolean.

How to solve the issue?

Splitting the method may simplify its code and provide a better description for the consumer.

What to do in case of exception?

In exceptional cases, you can suppress this finding by using the pseudo comment "#EC BOOL_PARAM which has to be placed after the method declaration:

  METHODS update IMPORTING do_save TYPE abap_bool. "#EC BOOL_PARAM

Example

Before the check:

  METHODS update IMPORTING do_save TYPE abap_bool.

After the check:

  METHODS update_without_saving.
  METHODS update_and_commit.

Further Readings & Knowledge