-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor: fix general issues #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… type checking, and improve error handling in tests
…g, and update project references
… accessibility, and update documentation comments
…t, and enhance property initialization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR tightens code quality and CI enforcement while refactoring the ProjGraph libraries/CLI/MCP integration to use stronger abstractions (rendering format selection, file-path guards, console I/O abstraction, deterministic IDs), and adds/updates repository documentation and specs.
Changes:
- Enforces stricter analysis/formatting (new analyzers,
dotnet formatCI gate, coverage artifacts) and improves contributor/security documentation. - Refactors rendering/DI to support renderer format selection via
IDiagramRenderer<T>.Format, introduces shared Mermaid fence helper, and extendsIOutputConsole/IFileSystem. - Updates MCP/CLI behavior and tests (async MCP methods, stricter argument validation, shared test helpers, expanded contract/DI wiring tests).
Reviewed changes
Copilot reviewed 131 out of 131 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ProjGraph.Tests.Unit.ProjectGraph/MermaidGraphRendererTests.cs | Updates string comparisons for analyzer compliance. |
| tests/ProjGraph.Tests.Unit.ProjectGraph/GraphServiceTests.cs | Updates service construction to match new DI/constructor signatures and improves skip behavior. |
| tests/ProjGraph.Tests.Unit.EntityFramework/EfAnalysisServiceTests.cs | Updates analyzer construction with new dependency. |
| tests/ProjGraph.Tests.Unit.EntityFramework/EfAnalysisServiceSnapshotTests.cs | Updates analyzer construction and collection access patterns. |
| tests/ProjGraph.Tests.Unit.EntityFramework/EfAnalysisAdvancedTests.cs | Updates analyzer construction with new dependency. |
| tests/ProjGraph.Tests.Unit.Core/ProjGraph.Tests.Unit.Core.csproj | Adjusts project references (moves Core ref into shared test project). |
| tests/ProjGraph.Tests.Unit.Core/Parsers/SlnxParserTests.cs | Adds ordinal comparisons and minor LINQ simplification. |
| tests/ProjGraph.Tests.Unit.Core/Parsers/SlnParserTests.cs | Adds ordinal comparisons for analyzer compliance. |
| tests/ProjGraph.Tests.Unit.Core/Parsers/ProjectParserTests.cs | Updates ProjectParser ctor usage and adds deterministic-ID test coverage. |
| tests/ProjGraph.Tests.Unit.ClassDiagram/MermaidClassDiagramRendererTests.cs | Refactors test setup to use collection initializers for members. |
| tests/ProjGraph.Tests.Unit.ClassDiagram/ClassAnalysisServiceTests.cs | Updates TypeProcessor construction to use SymbolResolver dependencies. |
| tests/ProjGraph.Tests.Unit.ClassDiagram/ClassAnalysisDepthTests.cs | Adds depth-limit tests and updates TypeProcessor construction dependencies. |
| tests/ProjGraph.Tests.Shared/ProjGraph.Tests.Shared.csproj | Adds shared reference to Core library for shared helpers. |
| tests/ProjGraph.Tests.Shared/Helpers/TestPathHelper.cs | Introduces shared path resolution for tests (samples/root). |
| tests/ProjGraph.Tests.Shared/Helpers/TestDirectory.cs | Narrows exception catches during temp directory cleanup. |
| tests/ProjGraph.Tests.Shared/Helpers/SkipTestException.cs | Adds xUnit dynamic-skip exception helper. |
| tests/ProjGraph.Tests.Shared/Helpers/NullOutputConsole.cs | Adds no-op console implementation for tests. |
| tests/ProjGraph.Tests.Integration.Mcp/McpProjectGraphTests.cs | Adds new MCP integration tests for project-graph tool behavior. |
| tests/ProjGraph.Tests.Integration.Mcp/McpIntegrationTests.cs | Replaces previous sync graph assertions with null/empty argument tests. |
| tests/ProjGraph.Tests.Integration.Mcp/McpErdTests.cs | Switches MCP ERD calls to async API and changes error expectations to exceptions. |
| tests/ProjGraph.Tests.Integration.Mcp/McpClassDiagramTests.cs | Switches MCP class diagram calls to async API and uses dynamic skip for missing files. |
| tests/ProjGraph.Tests.Integration.Mcp/Helpers/McpTestHelper.cs | Updates tool wiring to new constructors/logging/console abstractions; makes helper internal. |
| tests/ProjGraph.Tests.Integration.Cli/MarkdownErdTests.cs | Simplifies console capture lambda usage. |
| tests/ProjGraph.Tests.Integration.Cli/Helpers/CliTestHelpers.cs | Centralizes path resolution via TestPathHelper and removes timing sleep. |
| tests/ProjGraph.Tests.Integration.Cli/ErdCommandTests.cs | Simplifies console capture lambdas. |
| tests/ProjGraph.Tests.Integration.Cli/ClassDiagramDiscoveryTests.cs | Tightens class visibility/sealing and removes unnecessary finalizer suppression. |
| tests/ProjGraph.Tests.Contract/ProjGraph.Tests.Contract.csproj | Adds DI package for container wiring contract tests. |
| tests/ProjGraph.Tests.Contract/McpProjectGraphContractTests.cs | Adds explicit MCP API contract tests for GetProjectGraphAsync signature/attributes. |
| tests/ProjGraph.Tests.Contract/McpErdContractTests.cs | Updates contract tests to async ERD tool method and adds cancellation-token expectation. |
| tests/ProjGraph.Tests.Contract/McpContractTests.cs | Refactors to validate expected tool method names and presence of MCP tool attributes. |
| tests/ProjGraph.Tests.Contract/McpClassDiagramTests.cs | Updates contract tests to async method naming. |
| tests/ProjGraph.Tests.Contract/DiWiringTests.cs | Adds DI wiring contract tests for core services and renderer registration. |
| src/ProjGraph.Mcp/README.md | Updates MCP ERD parameter documentation (DbContext/ModelSnapshot naming). |
| src/ProjGraph.Mcp/ProjGraph.Mcp.csproj | Exposes internals to integration/contract test projects. |
| src/ProjGraph.Mcp/Program.cs | Refactors MCP tool methods to async, adds argument/file validation, adds versioning, no-op console binding, and snapshot support logic. |
| src/ProjGraph.Mcp/NullOutputConsole.cs | Adds MCP-specific no-op console to keep stdio JSON-RPC clean. |
| src/ProjGraph.Lib/DependencyInjection.cs | Renames DI type to ServiceRegistration (composition root wiring). |
| src/ProjGraph.Lib.ProjectGraph/Rendering/TreeGraphRenderer.cs | Adds Format and refactors base member naming usage. |
| src/ProjGraph.Lib.ProjectGraph/Rendering/SolutionGraphRendererBase.cs | Adds Format, refactors writer/console properties, and implements IDisposable. |
| src/ProjGraph.Lib.ProjectGraph/Rendering/MermaidGraphRenderer.cs | Adds Format, uses shared Mermaid fence helper, and makes replacements ordinal. |
| src/ProjGraph.Lib.ProjectGraph/Rendering/FlatGraphRenderer.cs | Adds Format and refactors base member naming usage. |
| src/ProjGraph.Lib.ProjectGraph/DependencyInjection.cs | Renames DI type and registers graph renderers + interface bindings. |
| src/ProjGraph.Lib.ProjectGraph/Application/UseCases/BuildGraphUseCase.cs | Adds logging + warning output when skipping broken projects; expands constructor dependencies. |
| src/ProjGraph.Lib.ProjectGraph/Application/GraphService.cs | Adds constructor XML-doc param and minor formatting. |
| src/ProjGraph.Lib.EntityFramework/Rendering/MermaidErdRenderer.cs | Adds Format, uses shared Mermaid fence helper, and makes replacements ordinal/invariant. |
| src/ProjGraph.Lib.EntityFramework/ProjGraph.Lib.EntityFramework.csproj | Exposes internals to relevant test projects. |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/RelationshipAnalyzer.cs | Refactors relationship detection, foreign key marking for immutable properties, and join-table naming logic. |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/PropertyConfigParser.cs | Adds Fluent API property-configuration parsing (max length, precision, defaults, etc.). |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/Patterns/EfAnalysisRegexPatterns.cs | Fixes region label/comment. |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/ModelSnapshotParser.cs | Makes Replace ordinal. |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/FluentApiParsingUtilities.cs | Adds shared parsing utilities for EF Fluent API parsing. |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/Extensions/TypeSymbolExtensions.cs | Improves string comparison usage and simplifies value-type check. |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/Extensions/RelationshipExtensions.cs | Uses simplified ordering (Order()) for stable relationship keys. |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/EntityAnalyzer.cs | Moves attribute constraint extraction into property creation; adds invariant parsing helper. |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/EfPropertyFactory.cs | Adds factory for copying immutable EfProperty instances. |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/DefaultValueResolver.cs | Adds resolver for default values (including Roslyn constant/enum resolution). |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/DbContextIdentifier.cs | Makes base-type string matching ordinal. |
| src/ProjGraph.Lib.EntityFramework/Infrastructure/Constants/EfAnalysisConstants.cs | Tightens accessibility (internal nested types), reuses FilePathGuard constants, and renames string constant. |
| src/ProjGraph.Lib.EntityFramework/DependencyInjection.cs | Renames DI type and registers IEntityFileDiscovery + EF services/use cases. |
| src/ProjGraph.Lib.EntityFramework/Application/UseCases/DiscoverSnapshotsUseCase.cs | Uses FilePathGuard and adjusts parsing to satisfy analyzers. |
| src/ProjGraph.Lib.EntityFramework/Application/UseCases/DiscoverContextsUseCase.cs | Uses FilePathGuard and adjusts parsing to satisfy analyzers. |
| src/ProjGraph.Lib.EntityFramework/Application/UseCases/AnalyzeSnapshotUseCase.cs | Uses FilePathGuard for path validation. |
| src/ProjGraph.Lib.EntityFramework/Application/UseCases/AnalyzeContextUseCase.cs | Uses FilePathGuard and removes duplicated validation helper. |
| src/ProjGraph.Lib.EntityFramework/Application/IEntityFileDiscovery.cs | Adds interface for discovering referenced entity/base-class files. |
| src/ProjGraph.Lib.EntityFramework/Application/EfAnalysisService.cs | Adds ctor param docs and exposes snapshot discovery/analysis plumbing. |
| src/ProjGraph.Lib.Core/ProjGraph.Lib.Core.csproj | Adds logging abstractions package. |
| src/ProjGraph.Lib.Core/Parsers/SlnxParser.cs | Adds ctor param doc and minor formatting. |
| src/ProjGraph.Lib.Core/Parsers/SlnParser.cs | Adds ctor param doc and minor formatting. |
| src/ProjGraph.Lib.Core/Parsers/ProjectParser.cs | Switches to injected filesystem for cwd and adds deterministic project IDs + ParsingException. |
| src/ProjGraph.Lib.Core/Infrastructure/WorkspaceRootResolver.cs | Adds shared workspace/solution root resolution helper. |
| src/ProjGraph.Lib.Core/Infrastructure/SpectreOutputConsole.cs | Adds stderr console caching, plus new interactive/status APIs for IOutputConsole. |
| src/ProjGraph.Lib.Core/Infrastructure/ProjectDiscoveryService.cs | Adds logging + console warnings and adjusts hashing logic. |
| src/ProjGraph.Lib.Core/Infrastructure/PhysicalFileSystem.cs | Adds async read and current-directory APIs to match IFileSystem changes. |
| src/ProjGraph.Lib.Core/Infrastructure/DirectoryFilters.cs | Adds shared directory exclusion set using FrozenSet. |
| src/ProjGraph.Lib.Core/Infrastructure/CompilationFactory.cs | Narrows exception catches and improves docs. |
| src/ProjGraph.Lib.Core/Domain/Algorithms/TarjanSccAlgorithm.cs | Documents recursion depth risk. |
| src/ProjGraph.Lib.Core/DependencyInjection.cs | Renames DI type and adds default NullLogger<> registration. |
| src/ProjGraph.Lib.Core/Abstractions/MermaidFenceHelper.cs | Adds shared helper for Mermaid Markdown fencing and optional YAML titles. |
| src/ProjGraph.Lib.Core/Abstractions/IOutputConsole.cs | Adds interactive selection and status execution APIs. |
| src/ProjGraph.Lib.Core/Abstractions/IFileSystem.cs | Adds async read and current-directory APIs. |
| src/ProjGraph.Lib.Core/Abstractions/IDiagramRenderer.cs | Adds Format property for renderer selection. |
| src/ProjGraph.Lib.Core/Abstractions/FilePathGuard.cs | Adds shared .cs path validation constants/guard. |
| src/ProjGraph.Lib.Core/Abstractions/DiagramOptions.cs | Adds WrapInMarkdownFence option for output control. |
| src/ProjGraph.Lib.ClassDiagram/Rendering/MermaidClassDiagramRenderer.cs | Adds Format, uses Mermaid fence helper, and improves string comparisons/invariant output. |
| src/ProjGraph.Lib.ClassDiagram/ProjGraph.Lib.ClassDiagram.csproj | Exposes internals to unit/integration tests. |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/WorkspaceTypeDiscovery.cs | Converts to DI service and uses shared workspace root + directory filters + FilePathGuard. |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/TypeProcessor.cs | Injects ISymbolResolver and refactors related-type resolution. |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/TypeFilter.cs | Uses FrozenSet for well-known type filtering and ordinal namespace checks. |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/TypeAnalyzer.cs | Simplifies method member parsing and uses ordinal string checks. |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/SymbolResolver.cs | Converts to DI service and uses AnalysisContext.AddSyntaxTrees. |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/RelationshipAnalyzer.cs | Uses ordinal comparisons in collection detection heuristics. |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/ISymbolResolver.cs | Adds public interface for symbol resolution. |
| src/ProjGraph.Lib.ClassDiagram/DependencyInjection.cs | Renames DI type and registers WorkspaceTypeDiscovery/SymbolResolver abstractions. |
| src/ProjGraph.Lib.ClassDiagram/Application/UseCases/AnalyzeFileUseCase.cs | Adds ctor param docs and analyzer suppressions for sync file read. |
| src/ProjGraph.Lib.ClassDiagram/Application/IWorkspaceTypeDiscovery.cs | Adds interface for workspace type discovery. |
| src/ProjGraph.Lib.ClassDiagram/Application/ITypeProcessor.cs | Adds missing XML doc params. |
| src/ProjGraph.Lib.ClassDiagram/Application/ClassAnalysisService.cs | Adds ctor param docs and minor formatting. |
| src/ProjGraph.Lib.ClassDiagram/Application/AnalysisContext.cs | Switches collections to Collection and adds AddSyntaxTrees helper. |
| src/ProjGraph.Core/Models/EfModel.cs | Makes EF domain models more immutable (init-only, Collection). |
| src/ProjGraph.Core/Models/ClassDiagramModels.cs | Strengthens enums and record typing (IReadOnlyList) + adds XML docs. |
| src/ProjGraph.Core/Exceptions/ProjGraphException.cs | Adds base exception for library-specific errors. |
| src/ProjGraph.Core/Exceptions/ParsingException.cs | Adds parsing-specific exception type. |
| src/ProjGraph.Core/Exceptions/AnalysisException.cs | Adds analysis-specific exception type. |
| src/ProjGraph.Cli/ProjGraph.Cli.csproj | Exposes internals to CLI integration tests. |
| src/ProjGraph.Cli/Program.cs | Makes Program internal. |
| src/ProjGraph.Cli/Infrastructure/DependencyInjection.cs | Makes Spectre DI adapter types internal. |
| src/ProjGraph.Cli/Commands/VisualizeCommand.cs | Switches renderer selection to Format, uses IOutputConsole status API, and improves settings normalization. |
| src/ProjGraph.Cli/Commands/ErdCommand.cs | Refactors to use IOutputConsole prompts/status, supports snapshots, and improves validation/errors. |
| src/ProjGraph.Cli/Commands/ClassDiagramCommand.cs | Refactors to use FilePathGuard and improves exception handling. |
| specs/003-mermaid-class-diagram/spec.md | Marks spec as Complete. |
| specs/003-mermaid-class-diagram/plan.md | Updates plan to reflect split library structure. |
| specs/002-dbcontext-erd/spec.md | Marks spec as Complete. |
| specs/002-dbcontext-erd/plan.md | Updates plan to reflect split library structure and decisions. |
| specs/001-cli-graph-rendering/spec.md | Marks spec as Complete. |
| specs/001-cli-graph-rendering/plan.md | Updates plan to reflect current repo structure. |
| specs/001-cli-graph-rendering/checklists/requirements.md | Updates checklist completeness marker. |
| samples/Directory.Build.props | Adds relaxed analysis settings for sample projects. |
| SECURITY.md | Adds security policy and reporting instructions. |
| README.md | Fixes CLI usage examples and Markdown formatting. |
| ProjGraph.slnx | Adds new documentation files and samples Directory.Build.props to solution items. |
| Directory.Packages.props | Adds analyzer/logging package versions; updates end-of-file newline. |
| Directory.Build.props | Enables stricter analysis and adds analyzer package references. |
| CONTRIBUTING.md | Adds contributor workflow and project guidance. |
| ARCHITECTURE.md | Adds architecture overview, dependency graph, and design decisions. |
| .github/workflows/publish.yml | Adds test step before packing. |
| .github/workflows/ci.yml | Adds formatting check, coverage collection, and coverage artifact upload. |
| .editorconfig | Fixes naming rules and enforces final newline insertion. |
Comments suppressed due to low confidence (1)
src/ProjGraph.Lib.ClassDiagram/Infrastructure/WorkspaceTypeDiscovery.cs:46
- This foreach loop immediately maps its iteration variable to another variable - consider mapping the sequence explicitly using '.Select(...)'.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/ProjGraph.Lib.ProjectGraph/Application/UseCases/BuildGraphUseCase.cs
Outdated
Show resolved
Hide resolved
…line at end of files
…on and source files
This pull request introduces significant improvements to project documentation, code quality enforcement, and CI workflows for the ProjGraph repository. The most notable changes include the addition of comprehensive documentation files, enhanced code analysis through analyzers, stricter code style and formatting enforcement, and improved CI processes for testing and coverage. Below are the key changes grouped by theme:
Documentation & Project Structure
ARCHITECTURE.mdwith a detailed overview of the solution structure, design decisions, and dependency graph.CONTRIBUTING.mdto guide new contributors on prerequisites, workflow, code style, and testing.SECURITY.mdoutlining the security policy and responsible vulnerability reporting process.ProjGraph.slnxto include new documentation files and asamples/Directory.Build.propsfor sample project settings. [1] [2]samples/Directory.Build.propsto relax code analysis and style checks for sample projects.Code Quality & Analysis
Microsoft.CodeAnalysis.NetAnalyzers,Roslynator,SonarAnalyzer.CSharp, etc.) and configuring related properties inDirectory.Build.propsandDirectory.Packages.props. [1] [2] [3]Continuous Integration & Testing
.github/workflows/ci.yml) to add formatting checks, collect code coverage, and upload coverage reports..github/workflows/publish.yml) by adding a test step before packaging.EditorConfig and Naming Rules
.editorconfigrules, including correct type parameter applicability, field naming conventions, and ensuring files end with a newline. [1] [2] [3]Spec & Documentation Updates
README.md. [1] [2]