Skip to content

Conversation

@JoeRobich
Copy link
Member

Backport of #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 microsoft/Microsoft.Unity.Analyzers#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 dotnet/format#1998
fixes microsoft/Microsoft.Unity.Analyzers#387
fixes #44867

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants