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

CodeCop rule AS0016 goes off too often and does not follow the documentation #6398

Closed sybrenwille closed 3 years ago

sybrenwille commented 3 years ago

Describe the bug This rule goes off with every field that does not have DataClassification. In our software the DataClassification is often specified on table level and only for non-standard fields on field level.

According to the documentation this should be possible. However, the codecop will go off on all fields where nothing is currently specified.

Documentation:

When the DataClassification property is set on a table level, the fields on the table will inherit the property value. If the DataClassification property is set on both a table and field level, then the data classification specified on a field level will override the one from the table.

To Reproduce Steps and to reproduce the behavior:

  1. Make sure CodeCop AS0016 generates errors.
  2. Create a table as following:
table 50000 "Demo Table"
{
    DataClassification = CustomerContent;
    fields
    {
        field(1; "My Field"; Code[20])
        {
            Caption = 'My Field';
        }
    }
}
  1. Compile the solution and see in the output of the compilation Error AS0016: Field with name 'My Field' must use the DataClassification property and its value should be different from ToBeClassified.

Expected behavior The codeCop should see if a DataClassification is specified at table level. If specified, it should not proceed at the field level.

Screenshots None

5. Versions:

qutreson commented 3 years ago

Hi @sybrenwille, thank you for reporting this issue and for the good repro.

This issue has already been fixed in our latest developer previews (AL extension version 7.*).

The field data classification is now inherited from the table.

image

sybrenwille commented 3 years ago

Hi @qutreson that's exactly what is needed. I'm looking forward to the availability of that version

atoader commented 3 years ago

I am closing this issue because it appears that it has been resolved. Please open a new issue if you believe this has not been resolved and reference the current issue.