Skip to content

BSL271 — Using unavailable in Unix objects

Summary

Using unavailable in Unix objects

Identifiers

Field Value
Rule code BSL271
Compatible alias UsingObjectNotAvailableUnix
Severity WARNING
Enabled by default Yes
Implemented Yes
Tags compatibility

Behavior

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

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

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

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

On Linux OS COM, OLE, ActiveDocument are not available. For integration use other options, for example XML file exchange or web-services. For COM AddIns, it is recommended to change them to NativeAPI AddIn.

Checked the use of unavailable in:

  • COMObject
  • Mail

Checking the value of the condition is not satisfied.

Addition

When found unavailable in Linux objects, the method is checked to include condition flow for platform type:

  • Linux_x86
  • Windows
  • MacOs

Examples

Component = New COMObject("System.Text.UTF8Encoding");

or

Mail = New Mail;
Instead of this you can use StartApplication().

SystemInformation = New SystemInformation();
If Not SystemInformation.PlatformType = PlatformType.Linux_x86 OR PlatformType.Linux_x86_64 Then
    Mail = New Mail;
EndIf;

Sources