Skip to content

Function name shouldn't start with "Получить" (FunctionNameStartsWithGet)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Code smell BSL
OS
Info No 3 standard

Parameters

Name Type Description Default value
prefixes String Comma-separated prefixes to strip (case-insensitive) ``

Description

The word Получить is redundant in a function name because a function returns a value by definition.

The prefixes parameter accepts a comma-separated list, for example "АЯ_, БСП_". The rule checks both the original name and the name following any one configured prefix, case-insensitively. Prefixes are literal text, not regular expressions. Surrounding whitespace and empty entries are ignored. The default empty value checks only the original name. Prefixes are not stripped repeatedly.

The rule checks the Russian word Получить; it does not check English Get.

Examples

With "prefixes": "АЯ_", АЯ_ПолучитьВажныеДанные() is also reported.

// Incorrect: 
Function ПолучитьИмяПоКоду()

// Correct: 
Function ИмяПоКоду()

Sources

Snippets

Diagnostic ignorance in code

// BSLLS:FunctionNameStartsWithGet-off
// BSLLS:FunctionNameStartsWithGet-on

Parameter for config

"FunctionNameStartsWithGet": {
    "prefixes": ""
}