How to ignore all whitespace issues when using dotnet format?

1.5k Views Asked by At

How to ignore all whitespace issues when using dotnet format?

I've generated an .editorconfig with mostly default options using these docs.

When I run this command...

dotnet format .\<SLN_NAME>.sln --verify-no-changes 

...I see errors like: <ABSOLUTE_FILE_PATH>\file.cs(1,1): error WHITESPACE: Fix whitespace formatting. Replace <N> characters with '<A_BUNCH_OF_SPACES>'.

I looked through the .editorconfig settings to try to find the source of the issue, and I reviewed these docs but I don't see anything that looks helpful.

Is there a way I can silence these errors?

1

There are 1 best solutions below

0
On BEST ANSWER

If you review this readme, you'll notice that you can use subcommands to target specific issues, one of which is whitespace.

This means you can run the commands below to target the non-whitespace subcommands, thus effectively ignoring your whitespace issues:

dotnet format style .\<SLN_NAME>.sln --verify-no-changes 
dotnet format analyzers .\<SLN_NAME>.sln --verify-no-changes