Skip to content
Arthur edited this page Jan 5, 2024 · 6 revisions

Procedure must be either local, internal or define a documentation comment.

This rule is to advises developers to carefully choose the scope of a method public, versus local or internal.

It highlights the importance of striking a balance between encapsulation and extensibility and recommends using documentation for deliberate exposure of procedures when needed. The goal is to simplify maintenance, reduce obsoletion issues, and ensure a controlled and well-documented public interface.

codeunit 50100 MyCodeunit
{
    procedure MyProcedure() // Procedure must be either local, internal or define a documentation comment.
    begin

    end;
}

XML Documentation

This rule wil not be raised when the public method has been provided with code documentation comments.

codeunit 50100 MyCodeunit
{
    /// <summary>
    /// This method ...
    /// </summary>
    procedure MyProcedure()
    begin

    end;
}

The code documentation comments feature, released with Microsoft Dynamics 365 Business Central 2020 Release Wave 2 (17), makes it easy to generate these XML documentation comments. There's also a AL XML Documentation extension for VS Code available.

Accessibility

This rule wil not be raised when the accessibility of the object itself is not public.

codeunit 50100 MyCodeunit
{
    Access = Internal;

    procedure MyProcedure()
    begin

    end;
}