Add suppressor support for dotnet format#48512
Merged
JoeRobich merged 12 commits intodotnet:mainfrom Aug 29, 2025
Merged
Conversation
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
1 similar comment
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
dotnet-format
dotnet-formatdotnet format
457ef9e to
119a5ee
Compare
119a5ee to
4940ff7
Compare
Contributor
Author
dd365ae to
cca26de
Compare
cca26de to
92a8b0d
Compare
…sdk into dotnet-format-suppressor-support
Contributor
Author
|
cc @tmat |
Contributor
Author
|
cc @KirillOsenkov @baywet @JoeRobich for awareness |
Contributor
Author
|
Any feedback ? Feel free to share your concerns or ideas. Thanks! |
Contributor
Author
|
Bumping @tmat for awareness, could we find someone to review this one please? |
JoeRobich
approved these changes
Aug 29, 2025
Member
|
/backport to release/10.0.1xx |
Contributor
|
Started backporting to release/10.0.1xx: https://github.com/dotnet/sdk/actions/runs/17564301161 |
Contributor
|
@JoeRobich backporting to "release/10.0.1xx" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Add suppressor support for dotnet-format
Applying: Add unit tests
Applying: Fix format
Applying: Improve comments
Applying: Add suppressor support for dotnet-format
Using index info to reconstruct a base tree...
M src/BuiltInTools/dotnet-format/Analyzers/AnalyzerFormatter.cs
M src/BuiltInTools/dotnet-format/Analyzers/CodeStyleInformationProvider.cs
Falling back to patching base and 3-way merge...
Auto-merging src/BuiltInTools/dotnet-format/Analyzers/CodeStyleInformationProvider.cs
CONFLICT (content): Merge conflict in src/BuiltInTools/dotnet-format/Analyzers/CodeStyleInformationProvider.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0005 Add suppressor support for dotnet-format
Error: The process '/usr/bin/git' failed with exit code 128Please backport manually! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 formatcommand on a unity solution to ensure projects obey the.editorconfiglinting rules:dotnet format --verify-no-changes --severity warnBut 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 (
NUnitandXUnitmake 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