[Backport][10.0.1xx] Add suppressor support for `dotnet format`
Backport of https://github.com/dotnet/sdk/pull/48512
Context:
Microsoft.Unity.Analyzers is able to add Unity-specific diagnostics or to remove general C# diagnostics that do not apply to Unity projects (through diagnostic suppressors).
One common usage is to run the dotnet format command on a unity solution to ensure projects obey the .editorconfig linting rules:
dotnet format --verify-no-changes --severity warn
But currently this command does not support diagnostic suppressors, which implies a lack of consistency with our IDEs and command-line build tools, which now manage suppressors.
See https://github.com/microsoft/Microsoft.Unity.Analyzers/issues/387 for a minimal repro.
Other scenarios are likely to be similar, such as the linting of test projects (NUnit and XUnit make use of diagnostic suppressors).
For this PR we tried to have a minimal impact, by just registering local project suppressors, when running the code-style phase.
Added unit tests as well.
fixes https://github.com/dotnet/format/issues/1998 fixes https://github.com/microsoft/Microsoft.Unity.Analyzers/issues/387 fixes https://github.com/dotnet/sdk/issues/44867 fixes https://github.com/dotnet/sdk/issues/51136
Oh is it already too late for 10.0.2? .1 was just released so .2 would be in January and now we need to wait until February?