Use Predicate Naming for Boolean Methods (is_, has_, can_)
WarningClean ABAP & Modern Syntax#EC PREF_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 PREF_PRED_NAME
" SAP CI_ prefix format:
... "#EC CI_PREF_PRED_NAMERelated Rules
- Enforce Class Attribute and Method Parameter Naming Conventions —
#EC PREF_NAME_MEMBERS - Enforce Class, Interface, Type and Object Naming Conventions —
#EC PREF_NAME_OBJECTS - Enforce Local Variable and Field-Symbol Naming Conventions —
#EC PREF_NAMING_VARS
Technical Details
- Native ATC Class:
ZCL_SKYLINT_PREF_PRED_NAME - Implementation File: zcl_skylint_pref_pred_name.clas.abap