Missing Caption/CaptionML
I have the following code from a custom you will note that there is no Caption/CaptionML. Should this condition not raise an error or a warning?
action(Action1190000013)
{
Ellipsis=true;
Image=WageLines;
Promoted=true;
//The property 'PromotedCategory' can only be set if the property 'Promoted' is set to 'true'
//PromotedCategory=Process;
RunObject=Page "Emp. Salary Review HR";
}
Some page elements (e.g. Groups, Gridlayout) don't require a caption but shouldn't fields and actions always have one? Fields at least can default back to the table Caption/CaptionML or worst case the field name but actions do not have such a fall back (unless it is the ID number).
It was taken from a GB database and for various non-relevant/valid reasons there are a number of page elements and tables fields that do NOT have an ENU Caption/CaptionML. They did have a Caption/CaptionML in another language (ENG) but before exporting the objects I stripped all non-ENU captions from the objects.
It might be useful to validate this at compile time and raise an error if CaptionML is missing, but we considered that there will be a large quantity of legacy code containing actions and fields that do not have this property set. We are thinking about creating a StyleCop rule for this scenario.
I agree legacy code would be an issue. A StyleCop rule would work for me. If I know how to run them! :smile:
This is a good candidate for a StyleCop rule.
I was about to file a new issue but I found this issue in which the request is made. This would be a huge help. I see this issue has been open for a longer time.
Here is another toy example I had:
group(Inventory)
{
field("Reserved Inventory"; "Reserved Inventory")
{
}
...
}
The group has no Caption property set, so will not get a translation, resulting in an incorrect caption when using different localizations -> for this case I would like to see an informational/warning message. The page-field within the group will inherit the translation from the table field, so there is no problem here-> for this case there should be no message.
Rule AA0221-AA0226 are validating caption