dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.11k stars 4.04k forks source link

IDE0130 cannot be disabled in .editorconfig #75169

Open RaceRalph opened 2 months ago

RaceRalph commented 2 months ago

Version Used: Visual Studio 17.11.4

Steps to Reproduce:

  1. In a c# project create a namespace which doesn't match the folder structure, e.g. in project Xxx use namespace Xxx in a c# file inside folder Yyy.

  2. In the .editorconfig in SolutionItems (shared by all projects in that solution) add the following lines:

    [*.cs]
    # IDE0130: Namespace does not match folder structure
    dotnet_diagnostic.IDE0130.severity = none
  3. Build the project.

Diagnostic Id: IDE0130 Namespace "Xxx" does not match folder structure, expected "Xxx.Yyy"

Expected Behavior: No message for IDE0130 should be issued.

Actual Behavior: A message is reported:

IDE0130 Namespace "Xxx" does not match folder structure, expected "Xxx.Yyy"

All other messages and warnings whose severity has been set to none in .editorconfig are suppressed, which means that in general the .editorconfig file works. Only the line which disables IDE0130 gets ignored.

vc-74 commented 2 months ago

As a workaround, you can use dotnet_style_namespace_match_folder = false (details)