AL icon indicating copy to clipboard operation
AL copied to clipboard

AA0072 CodeCop Rule - Incorrect warning with TestPage variables

Open JavierFuentes opened this issue 3 years ago • 0 comments

1. Describe the bug In test scenarios, when I declare a TestPage variable, this warning is displayed, but with Record variables (for example) it works fine and it is not displayed

2. To Reproduce

  1. Setup CodeCops in settings.json file
{
    "al.enableCodeAnalysis": true,
    "al.codeAnalyzers": [
        "${AppSourceCop}",
        "${CodeCop}",
        "${UICop}"
    ]
}
  1. Setup the app prefix in appSourceCop.json file
{
    "mandatoryPrefix": "prfx_"
}
  1. Declare a TestPage variable in a [Test] procedure

image

codeunit 90000 "prfx_Test IRPF"
{
    Subtype = Test;

    [Test]
    procedure SetupNewIRPFCodeWithANegativePercentageFromUI()
    var
        IRPF: Record "prfx_IRPF";
        IRPFList: TestPage "prfx_IRPF List";  // compiler forces us to name it as "prfx_IRPFList" to be ok
    begin
        // do something here!
    end;
}

3. Expected behavior This warning should not be shown with this type of variables used in TESTs.

4. Actual behavior The compiler forces us to add the prefix to the name of the variable of type TestPage

5. Versions:

  • AL Language: v9.5.674382
  • Visual Studio Code: 1.71.0
  • Business Central: not related to a BC version
  • List of Visual Studio Code extensions that you have installed: none

JavierFuentes avatar Sep 12 '22 09:09 JavierFuentes