Skip to content

Needless compilation directive (CompilationDirectiveNeedLess)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Code smell BSL Major Yes 1 clumsy
standard
unpredictable

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

Snippets

Diagnostic ignorance in code

// BSLLS:CompilationDirectiveNeedLess-off
// BSLLS:CompilationDirectiveNeedLess-on

Parameter for config

"CompilationDirectiveNeedLess": false