csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

Comment between attributes violates SA1515

Open maurobringolf opened this issue 9 months ago • 0 comments

Input:

public class C {

    [A]
    
    // moves up
    [B]
    public void A()
    {
        var z = 1;
        
        // stays here
        var y = 2;
    }
}

Output:

public class C
{
    [A]
    // moves up
    [B]
    public void A()
    {
        var z = 1;

        // stays here
        var y = 2;
    }
}

Expected behavior: The autoformatting causes the code not to comply with SA1515. According to the docs this rule is not in conflict with the CSharpier format. I expect the output to build without formatting warnings when configured as described.


As far as I can tell this can be resolved in two ways:

  1. Keep whitespace before comments in all cases (if that's possible).
  2. Add SA1515 to the to-be-disabled rules

I would favor the second option.

maurobringolf avatar May 06 '24 09:05 maurobringolf