AL icon indicating copy to clipboard operation
AL copied to clipboard

[BUG] AA0237 gives false positive on tables with table type Temporary

Open PeterConijn opened this issue 7 months ago • 0 comments

Please include the following with each issue:

1. Describe the bug When marking a table as table type temporary, it becomes a temporary table by default, regardless of whether the temporary modifier is added to a variable declaration for that table.

When declaring a variable for that table, AA0237 does not trigger if the Temp- prefix is not present, and is also falsely triggered when the Temp-prefix is present.

2. To Reproduce Steps to reproduce the behavior:

Create or find a table that is marked as temporary.

table 50100 "Permanently Temporary Table"
{
    Caption = 'Permanently Temporary Table';
    TableType = Temporary;

    // etc. etc.
}

Now declare a variable referencing the table:

local procedure MyProcedure()
var
    PermanentlyTemporaryTable: Record "Permanently Temporary Table";
begin
    // ....magic....
end;

In the instance above, I would expect AA0237 to trigger, since my table is always temporary and should thus be prefixed by Temp-. However, you fill find that AA0237 does not trigger in this case.

Now for the opposite example:

local procedure MyProcedure()
var
    TempPermanentlyTemporaryTable: Record "Permanently Temporary Table";
begin
    // ....magic....
end;

In this instance above, I would expect AA0237 not to trigger, since my table is always temporary and is now correctly prefixed by Temp-. Unfortunately, now the rule does trigger and scolds be for adding the Temp- prefix.

Note: Because the developers need to copy and paste the code snippet, including a code snippet as a media file (i.e. .gif) is not sufficient.

3. Expected behavior I expect AA0237 to trigger if a table is marked as temporary via TableType when the variable is not prefixed with Temp- and I expect it not to trigger if the Temp- prefix is present.

4. Actual behavior image

5. Versions:

  • AL Language:
  • Visual Studio Code: 13.1.1065068
  • Business Central: N/A
  • List of Visual Studio Code extensions that you have installed: [ "vscode.configuration-editing", "vscode.debug-auto-launch", "vscode.debug-server-ready", "vscode.emmet", "vscode.extension-editing", "vscode.git", "vscode.git-base", "vscode.github", "vscode.github-authentication", "vscode.json-language-features", "vscode.markdown-language-features", "vscode.markdown-math", "vscode.merge-conflict", "vscode.npm", "vscode.typescript-language-features", "andrzejzwierzchowski.al-code-outline", "BartPermentier.al-toolbox", "BhargavDetroja.export-your-extensions", "davidfeldhoff.al-codeactions", "eamodio.gitlens", "GitHub.copilot", "GitHub.copilot-chat", "GitHub.vscode-pull-request-github", "ms-dynamics-smb.al", "ms-vscode-remote.remote-containers", "rasmus.al-var-helper", "rvanbekkum.xliff-sync", "stefanmaron.businesscentral-lintercop", "usernamehw.errorlens", "waderyan.gitblame", "waldo.crs-al-language-extension" ]

Final Checklist

Please remember to do the following:

  • [x] Search the issue repository to ensure you are reporting a new issue

  • [x] Reproduce the issue after disabling all extensions except the AL Language extension

  • [x] Simplify your code around the issue to better isolate the problem

PeterConijn avatar Jul 26 '24 12:07 PeterConijn