Skip to content

Use Predicate Naming for Boolean Methods (is_, has_, can_) ​

WarningClean ABAP & Modern Syntax#EC PRED_NAMERemote Enabled

Overview ​

Enforce predicate naming (IS_, HAS_) on boolean methods.

ATC Finding Message: Boolean-returning method should use predicate name (IS_, HAS_, CAN_)

Rationale ​

A boolean method reads best as a yes/no question, especially when it appears inside an IF condition. Names such as check_active or get_active leave the return type ambiguous and can suggest a side effect. Use is_, has_, or can_ prefixes for methods that return abap_bool.

Non-Compliant ​

abap
METHODS check_active
  RETURNING VALUE(rv_active) TYPE abap_bool.

Compliant ​

abap
METHODS is_active
  RETURNING VALUE(rv_active) TYPE abap_bool.

Suppression ​

To suppress findings for this rule, append the pseudo-comment to the statement:

abap
" Standard pseudo-comment:
... "#EC PRED_NAME

" SAP CI_ prefix format:
... "#EC CI_PRED_NAME

Technical Details ​

Released under the MIT License.