17 questions
2
votes
1
answer
151
views
How to fix poor C# pattern formatting e.g. using editorconfig
I have the following code:
internal class Program
{
private static bool IsMatchingThing1(IThing thing)
{
return thing is
AThing {
Children: [
...
1
vote
2
answers
834
views
How to use dotnet format to apply IDE0300 on my entire solution?
I am trying to apply Use collection expression for array (IDE0300) suggestion.
I tried to execute the following:
dotnet format ProjectName.sln --diagnostics IDE0300
and also
dotnet format ProjectName....
1
vote
0
answers
817
views
dotnet format changes the encoding of the file
I am using dotnet format command to do code analysis with certain IDE's in the .editorconfig file.
However, some of the files I see in my git changes are just encoding changes and no text changes in ...
0
votes
1
answer
859
views
How to use `dotnet format` to apply specific StyleCop rule globally?
I have installed StyleCop.Analyzers on my project that is written using C#. The rules severity are set to suggestion.
How can I apply specific rules on the entire project using dotnet format?
I tried ...
1
vote
0
answers
926
views
Github Super Linter - C# Linter is not doing any style checks
I have set up Github super linter to lint C# files in my project. I added the rules in a .editorconfig file. But when I run the linter, I only get a bunch of whitespace errors and none of the styling ...
1
vote
1
answer
956
views
C# formatting with .editorconfig: can I use a different naming style for unit tests?
Is there a way to specify in an .editorconfig file that I want to use a different naming style for my Unit tests?
Currently we're using something like this: GetAll_GivenNoCustomers_ReturnsEmptyList ...
2
votes
0
answers
508
views
Use dotnet-format to change to file-scoped namespaces in C#10
I want to format a file to "file-scoped namespaces". I want to make that change only.
My .editorconfig contains this only:
[*.cs]
csharp_style_namespace_declarations = file_scoped:warning ...
2
votes
0
answers
313
views
Why is my editorconfig not throwing a naming error?
Applying a dotnet_naming_rule is not triggering a warning via dotnet format.
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
#### Naming ...
15
votes
4
answers
8k
views
Apply dotnet-format on save in Visual Studio?
I just discovered dotnet-format, but as far as I understand it's a command line tool that has to be called manually. How can I apply dotnet-format on saving a file in Visual Studio 2019? (not Visual ...