Skip to content

BSL186 — Commas without a parameter at the end of a method call

Summary

Commas without a parameter at the end of a method call

Identifiers

Field Value
Rule code BSL186
Compatible alias ExtraCommas
Severity WARNING
Enabled by default Yes
Implemented Yes
Tags syntax, style

Behavior

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

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

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

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

Do not include a comma at the end of a method call without specifying a parameter. It is difficult to understand and does not carry important information. Not required parameters under the principle of Occam's Razor "Do not multiply entities without need", since the "hanging" comma is not very informative.

Bad:

Result = Action (P1, P2 ,,);

Good:

Result = Action (P1, P2);

Sources