Skip to content

BSL170 — Needless compilation directive

Summary

Needless compilation directive

Identifiers

Field Value
Rule code BSL170
Compatible alias CompilationDirectiveNeedLess
Severity INFORMATION
Enabled by default Yes
Implemented Yes
Tags redundant, directive

Behavior

  • The public identifier BSL170 and alias CompilationDirectiveNeedLess 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 = ["BSL170"]
ignore = ["CompilationDirectiveNeedLess"]

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: BSL170
  • bsl-disable:
Value = "example";  // bsl-disable: BSL170
  • compatible BSLLS form:
Value = "example";  // BSLLS:CompilationDirectiveNeedLess-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: BSL170
// code without this diagnostic
// noqa-enable: BSL170

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

// BSLLS:CompilationDirectiveNeedLess-off
// code without this diagnostic
// BSLLS:CompilationDirectiveNeedLess-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

Compilation directives:

&AtClient (&НаКлиенте)
&AtServer (&НаСервере)
&AtServerNoContext (&НаСервереБезКонтекста)

Must be used only in the code of managed form modules and in the code of command modules. In other modules, we recommend use instructions to the preprocessor.

In server or client common modules, the execution context is obvious, so there is no sense in compilation directives. In common modules with client and server attributes, using compilation directives makes it difficult to understand which ones are procedures (functions) are available eventually.

Sources