Skip to content

Deprecated methods should not be used (DeprecatedMethodCall)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Code smell BSL
OS
Minor Yes 3 deprecated
design

Description

In cases where it becomes necessary to mark a procedure (function) as deprecated, the word "Deprecated." Is placed in the first line of its description (rus. "Устарела.").

Use or extension of deprecated methods should be avoided. Marking method as deprecated is a warning that means the method will be removed in future versions and left for temporary backward compatibility.

Exception: It is possible to call deprecated methods from deprecated methods.

Besides user-defined methods, the diagnostic also triggers on calls to platform methods and property accesses marked as deprecated in the syntax assistant. The deprecation data comes from the syntax assistant of the installed 1C platform (via bsl-context) or from the bundled reference, so the check works even without a connected platform reference. Triggering respects the target platform version: a member is treated as deprecated when the target version is not lower than the version the member was deprecated in. The target version is resolved by priority: the v8platform.targetVersion setting, then the configuration compatibility mode, and if neither is set the newest platform is assumed.

In addition, accesses to configuration properties prefixed with Удалить/Delete are highlighted — the standard 1C convention for marking deprecated attributes, enumeration values and configuration objects.

For OneScript the diagnostic also highlights accesses to members flagged as deprecated in the bundled type reference (the 1C platform versioning model does not apply to OneScript, so deprecation there is treated as "always deprecated").

Examples

// Deprecated. Need to use NotDeprecatedProcedure.
Procedure DeprecatedProcedure()
EndProcedure

DeprecatedProcedure(); // Triggering diagnostics

Sources

Snippets

Diagnostic ignorance in code

// BSLLS:DeprecatedMethodCall-off
// BSLLS:DeprecatedMethodCall-on

Parameter for config

"DeprecatedMethodCall": false