Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AA0198 is not reported for return variables of procedures #7741

Open
christianbraeunlich opened this issue May 5, 2024 · 0 comments
Open
Labels
CodeCop This is a specific static-code-analysis group (AA) requires-triage

Comments

@christianbraeunlich
Copy link

christianbraeunlich commented May 5, 2024

1. Describe the bug
The AA0198 warning is not issued for local/internal/public return variables of procedures that have the same name as global variables.

2. To Reproduce
Create a (local/internal/public) procedure with a named return variable and a global variable with the same name.

codeunit 50100 MyCodeunit
{
    var
        result: Boolean;

    procedure DoNotUseIdenticalNamesForLocalAndGlobalVariables() result: Boolean
    begin
        if result = false then
            result := true;
    end;
}

3. Expected behavior
Rule AA0198 should be displayed as a warning.

codeunit 50100 MyCodeunit
{
    var
        result: Boolean;

    procedure DoNotUseIdenticalNamesForLocalAndGlobalVariables() result: Boolean // AA0198: The name of the local variable 'result' is identical to a global variable.
    begin
        if result = false then
            result := true;
    end;
}

4. Actual behavior
Rule AA0198 is not displayed as a warning.

5. Versions:

  • AL Language: v13.0.1007491
  • Visual Studio Code:
    Version: 1.89.0 (user setup)
    Commit: b58957e67ee1e712cebf466b995adf4c5307b2bd
    Date: 2024-05-01T02:09:22.859Z
    Electron: 28.2.8
    ElectronBuildId: 27744544
    Chromium: 120.0.6099.291
    Node.js: 18.18.2
    V8: 12.0.267.19-electron.0
    OS: Windows_NT x64 10.0.22631
  • Business Central: N/A
  • List of Visual Studio Code extensions that you have installed:
    • ms-dynamics-smb.al
@BazookaMusic BazookaMusic added CodeCop This is a specific static-code-analysis group (AA) requires-triage labels May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CodeCop This is a specific static-code-analysis group (AA) requires-triage
Projects
None yet
Development

No branches or pull requests

2 participants