-
Notifications
You must be signed in to change notification settings - Fork 171
Description
It appears that dotnet format --verify-no-changes will result in a non-zero exit code for comments that are positioned within a single statement.
SomeMethodCall(
param1,
// this will be reported as a formatting error
param2 // this is reported, too
);The error message will be something like
error WHITESPACE: Fix whitespace formatting. Replace 14 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'.
but adjusting indentation doesn't fix the problem; only moving the comment out of the method call fixes it.
Additionally, just running dotnet format doesn't fix this. The only fix I think would be appropriate given the error would be to move the comment above the method call.
Interestingly, there is no problem with comments between statements inside lambda expressions that are themselves inside method calls.
SomeMethodCall(
param1,
() => {
Console.WriteLine("content");
// this is okay
Console.WriteLine("more content");
},
param2);Expected Behavior
Comments in these locations should be allowed. I'm not sure if there's a way to specify this in an .editorconfig file, though.
Alternatively, I would expect that formatting that is not fixed by dotnet format should not be reported by dotnet format --verify-no-changes.