Enforce Class Attribute and Method Parameter Naming Conventions
WarningClean ABAP & Modern Syntax#EC PREF_NAME_MEMBERSRemote Enabled
Overview
Class Attribute and Parameter Naming Conventions.
ATC Finding Messages:
Class attribute name does not match configured patternMethod parameter name does not match configured patternSelection screen element name does not match configured pattern
Rationale
Member variables and method signatures communicate the contract of object-oriented components. Enforcing prefixes (mv_* for instance attributes, gv_* for static attributes, iv_* for importing, ev_* for exporting, cv_* for changing, and rv_* for returning parameters) clarifies usage semantics across callers.
Non-Compliant
abap
METHODS execute
IMPORTING data TYPE i
RETURNING VALUE(result) TYPE i.Compliant
abap
METHODS execute
IMPORTING iv_data TYPE i
RETURNING VALUE(rv_result) TYPE i.Configuration & Thresholds
This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:
| Parameter Name | Data Type | Default Value | Description & Guidance |
|---|---|---|---|
ATTR_IGN_EXC | Boolean | true | Ignore exception class attributes (cx_*) |
ATTR_IGN_LOCAL | Boolean | true | Ignore attributes in local test classes |
ATTR_IGN_INTF | Boolean | false | Ignore interface component naming |
ATTR_STATICS | String | ^G._.+$ | Regex pattern for static class attributes (default: ^G._.+$) |
ATTR_INSTANCE | String | ^M._.+$ | Regex pattern for instance class attributes (default: ^M._.+$) |
ATTR_CONSTANTS | String | | Regex pattern for class constants (default: ^C._.+$) |
PARAM_IGN_EXC | Boolean | true | Ignore parameter naming in exception classes |
PARAM_IMPORTING | String | ^I._.+$ | Regex pattern for importing parameters (default: ^I._.+$) |
PARAM_RETURNING | String | ^R._.+$ | Regex pattern for returning parameters (default: ^R._.+$) |
PARAM_CHANGING | String | ^C._.+$ | Regex pattern for changing parameters (default: ^C._.+$) |
PARAM_EXPORTING | String | ^E._.+$ | Regex pattern for exporting parameters (default: ^E._.+$) |
SSCR_PARAM | String | ^P_.+$ | Regex pattern for selection screen parameters (default: ^P_.+$) |
SSCR_SELOPT | String | ^S_.+$ | Regex pattern for select-options (default: ^S_.+$) |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC PREF_NAME_MEMBERS
" SAP CI_ prefix format:
... "#EC CI_PREF_NAME_MEMBERSRelated Rules
- Enforce Class, Interface, Type and Object Naming Conventions —
#EC PREF_NAME_OBJECTS - Enforce Local Variable and Field-Symbol Naming Conventions —
#EC PREF_NAMING_VARS - Use Predicate Naming for Boolean Methods (is_, has_, can_) —
#EC PREF_PRED_NAME
Technical Details
- Native ATC Class:
ZCL_SKYLINT_PREF_NAME_MEMBERS - Implementation File: zcl_skylint_pref_name_members.clas.abap