Parameter is not referenced

Properties
LC0095 Warning Design Code Fix Ignore Obsolete

CodeCop AA0137 detects unreferenced parameters only in local procedures and explicitly excludes event subscribers. LC0095 covers the gaps: internal procedures, public procedures, and event subscribers.

A parameter that is never referenced in the procedure body clutters the signature, misleads callers about what the procedure needs, and creates unnecessary coupling. Removing it simplifies both the definition and every call site.

Example

codeunit 50100 MyCodeunit
{
    procedure MyProcedure(MyVariant: Variant) // Parameter 'MyVariant' is not referenced in procedure 'MyProcedure'. [LC0095]
    begin
    end;
}

Fixed:

codeunit 50100 MyCodeunit
{
    procedure MyProcedure()
    begin
    end;
}

Event subscriber example

Event subscribers often declare all the event’s parameters but only use a subset. The event infrastructure allocates and populates every declared parameter at each invocation, even the ones the subscriber never reads.

codeunit 50100 MyCodeunit
{
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", OnBeforePostSalesDoc, '', false, false)]
    local procedure OnBeforePostSalesDoc(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean) // Parameter 'SalesHeader' is not referenced in procedure 'OnBeforePostSalesDoc'. [LC0095]
    begin
        IsHandled := true;
    end;
}

Covered by this rule

  • Internal procedures
  • Public procedures
  • Event subscribers

Excluded from this rule

  • Local procedures (AA0137 handles them)
  • Triggers (platform-defined signatures, cannot be changed)
  • Interface implementations (bound by interface contract)
  • Event declarations ([IntegrationEvent]/[BusinessEvent], parameters define the subscriber contract)
  • Obsolete procedures (pending or removed, not worth modifying)

Relationship to AA0137

ScopeAA0137LC0095
Local procedures❌ (defers to AA0137)
Internal procedures
Public procedures
Event subscribers
Triggers
Interface implementations
Event declarations

See also