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

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

Open
3 tasks done
PeterConijn opened this issue Jul 26, 2024 · 0 comments
Open
3 tasks done
Labels
CodeCop This is a specific static-code-analysis group (AA) requires-triage

Comments

@PeterConijn
Copy link

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:

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

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

  • Simplify your code around the issue to better isolate the problem

@blrobl blrobl added requires-triage CodeCop This is a specific static-code-analysis group (AA) labels Aug 2, 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