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

Rule AA0072 only allows omitting defined affix/prefix/suffix on some object types, but not report/query (etc.?) #6681

Closed dzzzb closed 2 years ago

dzzzb commented 3 years ago

With this code:

table 50100 MyTestTableFOO
{
    DataClassification = CustomerContent;

    fields
    {
        field(50100; TableFieldFOO; Boolean)
        {
        }
    }
}

page 50100 MyTestPageFOO
{
    UsageCategory = None;
}

report 50100 MyTestReportFOO
{
    UsageCategory = None;
}

query 50100 MyTestQueryFOO
{
    elements
    {
        dataitem(Sales_Header; "Sales Header")
        {
            column(No_; "No.")
            {
            }
        }
    }
}

codeunit 50100 MyTestCodeunitFOO
{
    trigger OnRun()
    var
        MyTestTable: Record MyTestTableFOO;
        MyTestReport: Report MyTestReportFOO;
        MyTestCodeunit: Codeunit MyTestCodeunitFOO;
        MyTestPage: Page MyTestPageFOO;
        MyTestQuery: Query MyTestQueryFOO;
    begin
    end;
}

Most object types that I've tried can have the affix omitted from variables thereof, but for some reason Report and Query objects cannot, and AA0072 complains about them:

image

Presumably this allowance of omitting the defined affix is meant to work for any object type? If so, please fix this so that it will. If not, an explanation/documentation why not is required.

Thanks!

AL extension:

Name: AL Language
Id: ms-dynamics-smb.al
Description: AL development tools for Dynamics 365 Business Central
Version: 7.2.475273
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dynamics-smb.al
TKapitan commented 2 years ago

Any news? It's almost a year since the last update (in-progress) and it makes it challenging to use these cops...

Ugniusig commented 2 years ago

Also a TestPage object is shown as a warning

dzzzb commented 2 years ago

What is an example of the code, and what specific warning do you get?

Ugniusig commented 2 years ago

The same as you get @dnpb source code - https://github.com/Ugniusig/ALWarningExample

image

AL extension:

Name: AL Language
Id: ms-dynamics-smb.al
Description: AL development tools for Dynamics 365 Business Central
Version: v9.0.615906
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dynamics-smb.al
mazhelez commented 2 years ago

Thanks for reporting this issue. Sorry we haven’t completed it yet, but we’ve had to prioritize elsewhere. We’re planning to give the CodeCop engine and its rules an overhaul in a future major release. Thanks for your patience.

For this case consider using Pragma Warning Directive.