17 questions
Score of 2
1 answer
213 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: [
...
Score of 0
0 answers
1241 views
dotnet format keeps failing with 'Warnings were encountered while loading the workspace'
I have been trying to use dotnet format with an .editorconfig but it keeps on failing(details below).
Context:
In our repo we want to introduce formatters and linters. I decided to go ahead with ....
Score of 1
2 answers
990 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....
Score of 1
0 answers
184 views
Is there a way to use the dotnet format command to undo a rule?
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....
Score of 1
0 answers
918 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 ...
Score of 0
2 answers
2443 views
How to make `dotnet-format` ignoring certain directory?
I have the following lines defined in my .editorconfig file:
# Ignore paths
[Assets/NRSDK/*]
[Assets/VLCUnity/*]
generated_code = true
But they are ineffective, every time I run dotnet-format it ...
Score of 0
1 answer
947 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 ...
Score of 2
1 answer
1384 views
Dotnet-format not running in Github Action due to missing assembly
I've created a Github action to run dotnet format --verify-no-changes as part of our CI to check for formatting errors. Since to latest update of the Windows server from
OS Version: 10.0.20348 Build ...
Score of 1
0 answers
965 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 ...
Score of 1
0 answers
25 views
How can I convince the architect to allow me to format code?
In our team there is a refactoring sprint where we are allowed to refractor the code base. Now I discovered formatting with 'dotnet format' which automatically formats the whole solution.
The ...
Score of 1
1 answer
1022 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 ...
Score of 4
1 answer
4359 views
How to ignore all whitespace issues when using dotnet format?
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>....
Score of 2
0 answers
519 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 ...
Score of -1
1 answer
532 views
dotnet format validation throws dll not found
I want to validate the code style of my application according to the .editorconfig. For this task I use a local hosted agent in an azure (2019) ci pipeline. I'm only allowed to use local feeds. So I ...
Score of 2
0 answers
328 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 ...