BusinessCentral.LinterCop icon indicating copy to clipboard operation
BusinessCentral.LinterCop copied to clipboard

LC0051: Raise diagnostic on exit() Method

Open Arthurvdv opened this issue 1 month ago • 0 comments

It's a fictional example based on one of today's code review.

internal procedure GetFireTruck(): Text[10]
var
    FireTruckLbl: Label 'FireTruck';
begin
    exit(FireTruckLbl);
end;

When translation, for example to Dutch "Brandweerwagen", it becomes a length of 14 characters which will result in an runtime error. In this example the label should have a MaxLength or Locked property set.

FireTruckLbl: Label 'FireTruck', MaxLength = 20;
FireTruckLbl: Label 'FireTruck', Locked = true;

Arthurvdv avatar Feb 04 '25 11:02 Arthurvdv