dotnet / dotnet/format

Dotnet format doesnt seem to run Nunit3.Analyzers

Open
#1,481 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

I'm running dotnet 6.0.100, and utilizes dotnet format through that, yet when running it, it doesn't fix/complain about any of the issues that my IDE catches. More concretely I am trying to utilize [Nunit3 Analyzer](https://docs.nunit.org/articles/nunit-analyzers/NUnit-Analyzers.html)which I have added to each project as a dependency.

My editor catches them:
![image](https://user-images.githubusercontent.com/9048078/147574376-e4258ff0-9edc-4970-94cd-3cde6c1ad20e.png)

I am running `dotnet format --severity info` just to make sure everything is caught, and I've added each of the errors to my .editorconfig, which is obeyed regarding ordinary / other rules:
```
# Use constraint model for Nunit
dotnet_diagnostic.NUnit2001.severity = warning
dotnet_diagnostic.NUnit2002.severity = warning
dotnet_diagnostic.NUnit2003.severity = warning
dotnet_diagnostic.NUnit2004.severity = warning
dotnet_diagnostic.NUnit2005.severity = warning
dotnet_diagnostic.NUnit2006.severity = warning
dotnet_diagnostic.NUnit2007.severity = warning
dotnet_diagnostic.NUnit2008.severity = warning
dotnet_diagnostic.NUnit2010.severity = warning
dotnet_diagnostic.NUnit2011.severity = warning
dotnet_diagnostic.NUnit2012.severity = warning
dotnet_diagnostic.NUnit2013.severity = warning
dotnet_diagnostic.NUnit2014.severity = warning
dotnet_diagnostic.NUnit2015.severity = warning
[....]
```

I can see that dotnet format finds the editor config, yet I don't know how to figure out which analyzers it is using:
` dotnet format --verbosity diag --severity info`:

```
The dotnet runtime version is '6.0.1'.
The dotnet CLI version is '6.0.101'.
Using MSBuild.exe located in 'C:\Program Files\dotnet\sdk\6.0.101\'.
Formatting code files in workspace '...'.
Loading workspace.
Determining projects to restore...
All projects are up-to-date for restore.
....

Project ... is using configuration from 'C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk\analyzers\build\config\analysislevel_6_default.editorconfig'.
... is using configuration from '...\.editorconfig'.
... is using configuration from '....E2ETests.GeneratedMSBui
ldEditorConfig.editorconfig'.
Project .... is using configuration from 'C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk\analyzers\build\config\analysislevel_6_default.editorconfig'.
Complete in 6069ms.
Determining formattable files.
Complete in 1372ms.
Running formatters.
Running Code Style analysis.
Determining diagnostics...
Running 47 analyzers on ...
Running 47 analyzers on ...
Running 47 analyzers on ...

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.