feat: Phase 4b manual-review diagnostics for subclasses and copy-ctor#11
Merged
Conversation
Three additional lossy patterns Testably has no equivalent for. Code-fix provider intentionally registers no rewrite; the analyzer's role here is to make the call sites discoverable. Patterns added: - MockFileSystem.subclass (user-defined class deriving from MockFileSystem) - MockFileData.subclass (user-defined class deriving from MockFileData) - MockFileData.copyCtor (new MockFileData(MockFileData template)) The two subclass patterns use a NamedType symbol action so each class declaration is flagged once regardless of how many instantiations exist. The base-type walk follows the chain so transitively-derived classes (A : MockFileSystem, B : A) are both flagged. Framework types themselves are skipped. The copy ctor extends AnalyzeObjectCreation: when constructor.ContainingType is MockFileData and the single parameter is also MockFileData, the call site is flagged. The other MockFileData ctors (text/encoding/byte arrays) keep going through the existing AddFile expansion paths. The internal Report helper now has overloads for both OperationAnalysisContext and SymbolAnalysisContext, sharing a BuildDiagnostic factory.
There was a problem hiding this comment.
Pull request overview
Adds Phase 4b “manual review” diagnostics to the System.IO.Abstractions migration analyzer for additional lossy patterns that cannot be safely auto-rewritten, improving discoverability for users during migration.
Changes:
- Analyzer: flag user-defined subclasses of
MockFileSystem/MockFileDataat the class declaration (including transitive inheritance). - Analyzer: flag
new MockFileData(MockFileData template)(copy-ctor) call sites as manual-review. - Tests/playground: add analyzer + code-fix “no fix expected” coverage and parity fixtures for these patterns.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Testably.Abstractions.Migration.Tests/SystemIOAbstractionsCodeFixProviderTests.MockFileDataTests.cs | Adds “no fix” code-fix tests for MockFileData subclass and copy-ctor patterns. |
| Tests/Testably.Abstractions.Migration.Tests/SystemIOAbstractionsCodeFixProviderTests.ConstructorTests.cs | Adds “no fix” code-fix test for MockFileSystem subclass pattern. |
| Tests/Testably.Abstractions.Migration.Tests/SystemIOAbstractionsAnalyzerTests.cs | Adds analyzer tests for subclass + copy-ctor diagnostics, including transitive inheritance. |
| Tests/Testably.Abstractions.Migration.SystemIOAbstractionsPlayground/ManualReviewTests.cs | Adds manual-review parity fixtures demonstrating subclass and copy-ctor behavior. |
| Source/Testably.Abstractions.Migration.Analyzers/SystemIOAbstractionsAnalyzer.cs | Implements symbol-based subclass detection + copy-ctor detection; refactors diagnostic reporting helper. |
| Source/Testably.Abstractions.Migration.Analyzers/Patterns.cs | Introduces new pattern IDs for subclass and copy-ctor manual-review diagnostics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The "Manual-review patterns (Phase 4a)" header in Patterns.cs and the file-level summary on ManualReviewTests.cs both predate the Phase 4b patterns (subclasses, copy ctor). Split the Patterns.cs section into explicit 4a / 4b subsections and rewrite the playground summary to list both scopes so the docs match the file contents.
|
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.



Three additional lossy patterns Testably has no equivalent for. Code-fix provider intentionally registers no rewrite; the analyzer's role here is to make the call sites discoverable.
Patterns added:
The two subclass patterns use a NamedType symbol action so each class declaration is flagged once regardless of how many instantiations exist. The base-type walk follows the chain so transitively-derived classes (A : MockFileSystem, B : A) are both flagged. Framework types themselves are skipped.
The copy ctor extends AnalyzeObjectCreation: when constructor.ContainingType is MockFileData and the single parameter is also MockFileData, the call site is flagged. The other MockFileData ctors (text/encoding/byte arrays) keep going through the existing AddFile expansion paths.
The internal Report helper now has overloads for both OperationAnalysisContext and SymbolAnalysisContext, sharing a BuildDiagnostic factory.