Skip to content

BSL156 — Code out of region

Summary

Code out of region

Identifiers

Field Value
Rule code BSL156
Compatible alias CodeOutOfRegion
Severity INFORMATION
Enabled by default Yes
Implemented Yes
Tags convention, structure

Behavior

  • The public identifier BSL156 and alias CodeOutOfRegion are stable.
  • The rule reports the cases documented on this page.
  • Suppressions and project configuration are applied before publication.
  • The rule requires neither an external analyzer nor network access.

Configuration and suppression

BSL### is the primary stable identifier. The compatible alias is accepted in select, ignore, and compatible block suppression comments.

[tool.onec-hbk-bsl]
select = ["BSL156"]
ignore = ["CodeOutOfRegion"]

All three suppression families support both a current line and a range. When an opening comment follows code, it affects only that line. Use any one form:

  • noqa:
Value = "example";  // noqa: BSL156
  • bsl-disable:
Value = "example";  // bsl-disable: BSL156
  • compatible BSLLS form:
Value = "example";  // BSLLS:CodeOutOfRegion-off

When the same opening comment is on a line by itself, it starts a range. Close it with the matching marker from the same family:

// noqa: BSL156
// code without this diagnostic
// noqa-enable: BSL156

// bsl-disable: BSL156
// code without this diagnostic
// bsl-enable: BSL156

// BSLLS:CodeOutOfRegion-off
// code without this diagnostic
// BSLLS:CodeOutOfRegion-on

To disable the rule until the end of the file, omit the closing noqa-enable, bsl-enable, or BSLLS:…-on marker.

Opening and closing markers must belong to the same family.

Description

The code of module should be structured and divided into regions. The requirement to structure code by regions is to improve code readability and maintainability and development by group of authors (developers) and in finalizing application solutions on specific implementations.

Examples

#Region <RegionName>

The standard describes only 10 region names, the names of nested regions are not checked.

Correct:

#Region Private
#Region Print
// Methods code
#EndRegion
#Region Other
// Methods code
#EndRegion
#EndRegion

Name matching table (full in source code):

RU EN
ПрограммныйИнтерфейс Public
СлужебныйПрограммныйИнтерфейс Internal
СлужебныеПроцедурыИФункции Private
ОбработчикиСобытий EventHandlers
ОбработчикиСобытийФормы FormEventHandlers
ОбработчикиСобытийЭлементовШапкиФормы FormHeaderItemsEventHandlers
ОбработчикиКомандФормы FormCommandsEventHandlers
ОписаниеПеременных Variables
Инициализация Initialize
ОбработчикиСобытийЭлементовТаблицыФормы FormTableItemsEventHandlers

Sources