Skip to content

BSL042 - Unused local method

Summary

Unused local method

Identifiers

Field Value
Rule code BSL042
Compatible alias UnusedLocalMethod
Severity WARNING
Without configuration Yes
BSLLS JSON, ON mode without overrides Yes
Registry flag implemented Yes
Tags design, api

The implemented flag describes the registry; it does not certify verified BSLLS parity.

Behavior

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

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

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

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

A call on another object does not count as use of a same-named local method. The receiver comes from the CST, including multiline calls. Non-exported local methods are resolved for direct calls within the module. Standalone-file analysis remains part of the local contract; BSLLS rc.6 skips unknown module kinds. Result counts on standalone files alone do not establish whether this check is incorrect.

Modules should not have unused procedures and functions. Diagnostics can skip attachable methods that have prefixes specified in the diagnostic parameter.

Sources