Is there a way to use the dotnet format command to undo a rule?

80 Views Asked by At

Typically the dotnet format --diagnostics CODE command is used to apply a format in a project or a solution. However, is there a way to reverse that action?

For example, I prefer:

var sub = value.Substring(1, value.Length - 2);

over

var sub = value[1..^1];

I added the following in the .editorconfig file

csharp_style_prefer_index_operator = false : warning
dotnet_diagnostic.IDE0057.severity = warning

Now how can convert any value[1..^1]; syntax to value.Substring(1, value.Length - 2) using the dotnet format command?

I tried the following command

dotnet format --diagnostics IDE0057 --severity warn

It did not convert the syntax.

0

There are 0 best solutions below