Skip to content

BSL176 — Deprecated methods should not be used

Summary

Deprecated methods should not be used

Identifiers

Field Value
Rule code BSL176
Compatible alias DeprecatedMethodCall
Severity INFORMATION
Enabled by default Yes
Implemented Yes
Tags deprecated

Behavior

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

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

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

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