Repository navigation
fix(analyzers): match ByteSize by simple name and resolve it in the fix - #179
Merged
Merged
Conversation
E128080 exempted only Pug.Core.Classes.ByteSize, so a namespace move made the rule fire on the type's own unit properties. E128082 shared the probe. Match ByteSize by simple name, whatever its namespace. The E128080 code fix hardcoded the retired namespace. Resolve the type in the compilation, add the resolved namespace as a using, and qualify FromBytes with the resolved name. Bump the package to 3.1.5.
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.
Executive Summary
E128080 exempted only the fully qualified
Pug.Core.Classes.ByteSizename. After a consumer moved the type to another namespace, the rule fired on ByteSize's own unit properties and forced a pragma. E128082 used the same probe, so the cast rule stopped matching the moved type.The type is now matched by simple name in any namespace. The E128080 code fix also hardcoded the retired namespace, so it resolved the type at fix time instead: canonical name first, then a global-namespace walk for a type named
ByteSizewith a staticFromBytes.Code Changes
ByteSizeType.Ismatches a type namedByteSize, whatever its namespace. E128080 and E128082 share it.ByteSizeForDataSizeCodeFixProviderresolves the type in the compilation, adds the resolved namespace as a using, and qualifiesFromByteswith the resolved name.Tests and Tooling
scripts/check.sh --allpasses: shell, analyzer release, format, build, test.scripts/internal/analyzer-release-check.shis clean.scripts/readme-table-diff.sh --analyzerreports no drift. README audit is clean.Review Guide
src/E128.Analyzers/Design/ByteSizeType.csis the whole rule-side change.ByteSizeForDataSizeCodeFixProvider.ResolveByteSizeTypeandFindByteSizeTypeare the fixer-side change.Rollback
Revert the commit. The rule returns to the full namespace match and the fixer to the hardcoded namespace.