BSL054 — Ban export global module variables¶
Summary¶
Ban export global module variables
Identifiers¶
| Field | Value |
|---|---|
| Rule code | BSL054 |
| Compatible alias | ExportVariables |
| Severity | INFORMATION |
| Enabled by default | Yes |
| Implemented | Yes |
| Tags | design, global-state |
Behavior¶
- The public identifier
BSL054and aliasExportVariablesare 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.
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:
bsl-disable:
- compatible
BSLLSform:
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: BSL054
// code without this diagnostic
// noqa-enable: BSL054
// bsl-disable: BSL054
// code without this diagnostic
// bsl-enable: BSL054
// BSLLS:ExportVariables-off
// code without this diagnostic
// BSLLS:ExportVariables-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¶
In most scenarios, we recommend that you do not use global variables and use other 1C:Enterprise script tools instead. Since monitoring the visibility (usage) areas of such variables is tricky, they often might cause issues that cannot be easily located.
Examples¶
Variable FileConversion Export;
Procedure BeforeWrite(Cancel)
If FileConversion Then
...
EndProcedure
We recommend that you use the AdditionalProperties object property for passing parameters between event subscription handlers and for passing parameters from external script to object module event handlers
Procedure BeforeWrite(Cancel)
If AdditionalProperties.Property("FileConversion") Then
...
EndProcedure
// script that calls the procedure
FileObject.AdditionalProperties.Insert("FileConversion", True);
FileObject.Write();