chore: remove unnecessary using to fix the Lint check - #11085
Open
lahma wants to merge 1 commit into
Open
Conversation
`dotnet format --no-restore --verify-no-changes` currently fails on main with test/Docfx.Dotnet.Tests/SymbolUrlResolverUnitTest.cs(5,1): warning IDE0005: Using directive is unnecessary. No name in that file resolves through Microsoft.CodeAnalysis - the symbol types are only ever bound to `var` - so removing the directive leaves the file compiling unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uV6H9cTntzsoKiaJRBn4f
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.
The Lint check (
dotnet format --no-restore --verify-no-changes) is currently failing onmainand therefore on every open pull request. This removes the one directive it flags.Why the directive is genuinely unnecessary
No name written in that file resolves through
Microsoft.CodeAnalysis. The symbol types only ever appear bound tovar—CompilationHelper.CreateCompilationFromAssemblyis deconstructed intovar (compilation, assembly), and everything afterwards (assembly.GetTypeByMetadataName,type.GetMembers) is an instance member call, which needs no using. The file compiles unchanged without it.Evidence that this is pre-existing rather than PR-specific
mainat2a436495edreproduces the failure exactly:dotnet format --no-restore --verify-no-changesexits 2 with that single warning and nothing else.Docfx.Dotnet.Tests, which none of them touch.Verification
dotnet format --no-restore --verify-no-changes— the exact CI command — now exits 0 across the whole solution.Docfx.Dotnet.Tests, Release,net10.0: 172/172 passing, 0 build warnings.A durable fix worth considering separately
The repository pins no
global.json, so the analyzer set is whatever SDK the runner image happens to ship. IDE0005's analysis got stricter in a newer Roslyn and the check went red without anything in the repository changing — which is a failure mode that will recur on the next image bump. Pinning an SDK version inglobal.json(withrollForwardset to taste) would make the lint result reproducible rather than dependent on runner timing. I have left that out of this PR, since removing the directive is what unblocks CI today and the pin is a separate decision for you to make.