Modifier

Partager via


CodeCop Hidden AA0241

Use all lowercase letters for reserved language keywords.

Description

Use all lowercase letters for reserved language keywords. This rule does not apply to built-in methods and types; they must be written using Pascal case.

Remarks

We recommend following these best practices when developing extensions in AL to ensure consistency and discoverability on file, object, and method naming, as well as better readability of written code.

Data types in variable and parameter declarations aren't included in this rule because they're written using Pascal case.

Bad code example

trigger OnValidate()
BEGIN
    IF "Order Date" > "Starting Date" THEN
       Error(Text007, FieldCaption("Order Date"), FieldCaption("Starting Date"));
END;

VAR
    Text007: Label '%1 cannot be greater than %2.';

Good code example

trigger OnValidate()
begin
    if "Order Date" > "Starting Date" then
       error(Text007, FieldCaption("Order Date"), FieldCaption("Starting Date"));
end;

var
    Text007: Label '%1 cannot be greater than %2.'; // Label variable declaration in Pascal case

Good and bad practices for fixing the rule

Change every reserved language keyword to use lowercase letters. Use Pascal case for data types in variable and parameter declarations.

CodeCop Analyzer
Get Started with AL
Developing Extensions