Rediger

Del via


CodeCop Warning AA0244

Do not use identical names for parameters and global variables.

Description

Do not use identical names for parameters and global variables.

Remarks

This CodeCop rule is similar to AA0198, but it applies to method parameters. The rule warns when a method's parameters names collide with global variable names, but with the following specifics for Event declaration.

AA0244 doesn't warn on Events with the exception of Integration Events that have GlobalVarAccess set to true.

No warning

codeunit 50100 MyCodeunit
{
    // GlobalVarAccess = false hence we don't warn
    [IntegrationEvent(true, false)]
    local procedure MyNewEvent(EventParamA: Integer)
    begin
    end;
}

Warning

codeunit 50100 MyCodeunit
{
    // GlobalVarAccess = true hence we warn
    [IntegrationEvent(true, true)]
    local procedure MyNewEvent(EventParamA: Integer)
    begin
    end;
}

Note

Rule AA0244 warns on EventSubscribers and even if the subscribers don't have control over the names of the parameters, they have control over the global variables living in the Codeunit.

CodeCop Analyzer
Getting Started with AL
Developing Extensions