New CodeCops in the 2020 Wave 1

From a few days, you can install version 16 as your online sandbox. Great news! You also can read about new things on some blogs and twitter. I recommend you to read the blog from Stefano Demiliani or follow tweets from Andrey Baludin 

I would like to introduce you to a few new CodeCops warnings which you can have if you will switch to AL Language 5.0. I should explain that I am not sure when exactly they were introduced however when I developed my extension, those were things which hit me when I switched to the newest version of the language.

AA0215 – Checking file naming

This one checks if you are using the correct name of the file. In the past there very few versions of the guidelines but from some time you should not use the number, spaces nor affixes in the file names. Also, you should include the object type after a dot. More info you can find here:

AA0218 and AA0220 – Missing ToolTips

Finally. That was something which I was looking for quite some time. If you would forget to add the ToolTip to the control or action now you will have a reminder about it.

AA0219 – Wrong ToolTip

This option needs to be switch on in the RuleSet. If you are adding the ToolTip for the field it will be checked if you started with the word “Specifies“. 

AA0470 – Add comments to the Labels

Commonly, we write the labels which contain some placeholders which later will be replaced in a message, an error or the StrSubstNo(). However, at least me, I sometimes forget to add the comment about what kind of data is expected in the placeholder. Now you will see the warning if you would not do so.

To fix it you need to specify the comment. And you need to specify all placeholders in the comment.

AA0205 – Declare initial variable’s value

Now you will get a warning if you would not first declare the value of the variable and you will try to use it. In the below example you can see that I declared Boolean but never assigned the value. By default, it is false but anyway I will get a warning.

More information and examples of bad and good code you can find here: 

More on Microsoft Docs

Are those all CodeCops that have been added? No. Those are which may have an impact on your solutions just after the switch to the language 5.0 version. There are also some new AppSourceCops related to the Obsolete State and the Interfaces. However, I did not want to focus at this moment on them. You can find the full list here:

One Comment

Add a Comment

Your email address will not be published.