AL icon indicating copy to clipboard operation
AL copied to clipboard

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

Open dzzzb opened this issue 5 years ago • 5 comments

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

dzzzb avatar Jun 24 '21 16:06 dzzzb

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

TKapitan avatar May 11 '22 12:05 TKapitan

Also a TestPage object is shown as a warning

Ugniusig avatar May 30 '22 13:05 Ugniusig

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

dzzzb avatar May 31 '22 08:05 dzzzb

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

Ugniusig avatar Jun 02 '22 08:06 Ugniusig

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.

mazhelez avatar Jun 24 '22 11:06 mazhelez