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

LC0072 False positive on spaces in parameter name

Open admin-bierfestival opened this issue 10 months ago • 4 comments

/// <summary>
/// 
/// </summary>
/// <param name="TemplateSelection"></param>
/// <param name="Label Type Code"></param>
procedure GetTemplateSelection(var TemplateSelection: Record "Template Selection LNBSF"; "Label Type Code": Code[20])

This triggers the warning "The documentation comment does not match the procedure syntax". Even when the param name is correct.

admin-bierfestival avatar Jan 24 '25 12:01 admin-bierfestival

Image

@ans-bar-bm I could use your help on this.

The <param name="Label Type Code"></param> somehow returns the value Label for the parameterName, instead of "Label Type Code".

The only workaround I can find is nameAttribute.ToString().Split('=')[1], where I mostly try to avoid string manipulation.

Do you have an idea on howto resolve this?

Example code snippet below

codeunit 50100 MyCodeunit
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="TemplateSelection"></param>
    /// <param name="Label Type Code"></param>
    procedure GetTemplateSelection(var TemplateSelection: Record "Template Selection LNBSF"; "Label Type Code": Code[20])
    begin

    end;
}

table 50100 "Template Selection LNBSF"
{
    fields
    {
        field(1; MyField; Integer) { }
    }
}

Arthurvdv avatar Jan 25 '25 13:01 Arthurvdv

@ans-bar-bm I could use your help on this.

Unfortunatly i don't really know why this is happening, since i'm not too familiar with the inner workings of the code analysis (most of my stuff is trial and error). It seems in the xml documentation part the Identifier only has the "Label" part itself, all the other stuff (" Type Code") seems to be under its Trailing Trivia. Probably that has the be evaluated too and added to the parameter name?

Image

As i said i'm not really sure why, since later when evaluating the methodDeclarationSyntax Parameter stuff the ValueText contains the whole thing... Seems a bit weird to me that these behave differently between the xml documentation part and the actual parameter part.

Image

ans-bar-bm avatar Jan 27 '25 08:01 ans-bar-bm

Ah...I didn't know they where hiding under the TrailingTrivia property 🤔 This was of great help to find a solution for this, thanks @ans-bar-bm!

Arthurvdv avatar Jan 28 '25 08:01 Arthurvdv

Version v0.34.0 of LinterCop has been released as the latest version.

Could you verify if it is working as expected? If everything looks good, would be great if you could close this issue.

Arthurvdv avatar Jan 31 '25 13:01 Arthurvdv