microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
744 stars 245 forks source link

Disable AL0604 and AL0606 with pragma are not working #6700

Closed AlexCeg closed 3 years ago

AlexCeg commented 3 years ago

1. Describe the bug It is not possible to disable warning AL0604 and AL0606 if this should throw an error.

2. To Reproduce Create this AL-File:

codeunit 50002 "Test"
{
    Access = Internal;
    TableNo = Item;
    trigger OnRun()
    var
        Item: Record Item;
    begin
#pragma warning disable AL0604,AL0606
        Copy(Item);
        with Item do begin
            Description := Format(CurrentDateTime());
        end;

    end;

}

use this ruleset:

{
    "name": "Our ruleset",
    "description": "Some specific rules",
    "rules": [
        {
            "id": "AL0604",
            "action": "Error",
            "justification": "Use of implicit 'with' will be removed in the future. Qualify with 'Rec.'."
        },
        {
            "id": "AL0606",
            "action": "Error",
            "justification": "The 'with' statement is deprecated and will be removed for cloud development in a future release."
        }
    ]
}

3. Expected behavior It is possible to disable warning AL0604 and AL0606 for single objects.

4. Actual behavior image

5. Versions:

esbenk commented 3 years ago

If you have elevated a warning to an error in a ruleset then it can't be suppressed. This is by design.

AlexCeg commented 3 years ago

It works for CodeCop warning like AA0181. Why does it not work for AppSourceCop warnings?