Skip to content

Mixing Latin and Cyrillic characters in one identifier (LatinAndCyrillicSymbolInWord)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Code smell BSL
OS
Minor Yes 5 brainoverload
suspicious

Parameters

Name Type Description Default value
excludeWords String A list of exclusion words, specified as a comma-separated string ЧтениеXML, ЧтениеJSON, ЗаписьXML, ЗаписьJSON, ComОбъект, ФабрикаXDTO, ОбъектXDTO, СоединениеFTP, HTTPСоединение, HTTPЗапрос, HTTPСервисОтвет, SMSСообщение, WSПрокси
allowTrailingPartsInAnotherLanguage Boolean Allow a name to start or end with a word in another language true

Description

Do not use identifiers consisting of characters from different languages, вecause it makes it difficult to use them further, forcing to switch the layout.
Also, the diagnostics detects the erroneous use of characters from another language, when it was used unintentionally. For exaple: o, c, B, p and etc.

To reduce "noise" in the names consisting of several words beginning or ending in the word in another language, in the diagnostics option has been added that is included by default.
If the parameter is enabled, then NOT are considered erroneous names like ZebraДрайвер, КодHTTP, SMSШлюз and the like.

Examples

Sources

Snippets

Diagnostic ignorance in code

// BSLLS:LatinAndCyrillicSymbolInWord-off
// BSLLS:LatinAndCyrillicSymbolInWord-on

Parameter for config

"LatinAndCyrillicSymbolInWord": {
    "excludeWords": "ЧтениеXML, ЧтениеJSON, ЗаписьXML, ЗаписьJSON, ComОбъект, ФабрикаXDTO, ОбъектXDTO, СоединениеFTP, HTTPСоединение, HTTPЗапрос, HTTPСервисОтвет, SMSСообщение, WSПрокси",
    "allowTrailingPartsInAnotherLanguage": true
}