Skip to content

Comments

Fix: sonar issue on mcp#27

Merged
HandyS11 merged 3 commits intodevelopfrom
fix/sonar-issue-mcp
Feb 17, 2026
Merged

Fix: sonar issue on mcp#27
HandyS11 merged 3 commits intodevelopfrom
fix/sonar-issue-mcp

Conversation

@HandyS11
Copy link
Owner

@HandyS11 HandyS11 commented Feb 17, 2026

This pull request refactors the way analysis options are handled for class diagram generation, consolidating multiple boolean and integer parameters into a single AnalysisOptions record. This change simplifies the API surface, improves maintainability, and updates all relevant code, documentation, and tests to use the new approach. Additionally, the CodeQL workflow is streamlined to use autobuild instead of manual build steps.

API and Codebase Refactoring:

  • Replaced multiple parameters (includeInheritance, includeDependencies, includeProperties, includeFunctions, depth) with a single AnalysisOptions record in the IClassAnalysisService, ClassAnalysisService, AnalyzeFileUseCase, and public CLI/MCP interfaces. All usages and XML documentation are updated accordingly. [1] [2] [3] [4] [5] [6] [7] [8]
  • Updated integration and contract tests to use the new AnalysisOptions parameter, removing checks for the old individual flags and adding checks for the new record. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Documentation Updates:

  • Updated CONTRIBUTING.md and specs/004-config-class-members/data-model.md to reflect the new AnalysisOptions structure and correct table formatting. [1] [2] [3]

Workflow Improvements:

  • Simplified the CodeQL workflow by switching from manual build to autobuild and removing the explicit build step.
  • Removed the pull_request trigger from the CodeQL workflow schedule.

Copilot AI review requested due to automatic review settings February 17, 2026 13:09
Copy link
Contributor

Copilot AI left a 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 refactors the ClassDiagram analysis API to address a SonarQube code smell about having too many method parameters. The changes consolidate five optional parameters (includeInheritance, includeDependencies, includeProperties, includeFunctions, maxDepth) into a single AnalysisOptions record parameter.

Changes:

  • Converted AnalysisOptions from a class with required properties to a record with default parameter values
  • Refactored IClassAnalysisService.AnalyzeFileAsync and related methods to accept an AnalysisOptions? parameter instead of multiple boolean/int parameters
  • Updated MCP tool interface to use the new options parameter with appropriate descriptions for API documentation
  • Updated all call sites across unit tests, integration tests, and contract tests to use the new signature

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/ProjGraph.Lib.ClassDiagram/Application/AnalysisOptions.cs Converted from class to record with default parameter values and Description attributes
src/ProjGraph.Lib.ClassDiagram/Application/IClassAnalysisService.cs Simplified signature to accept single AnalysisOptions parameter
src/ProjGraph.Lib.ClassDiagram/Application/ClassAnalysisService.cs Updated implementation to pass options to use case
src/ProjGraph.Lib.ClassDiagram/Application/UseCases/AnalyzeFileUseCase.cs Updated to accept options parameter with null-coalescing default
src/ProjGraph.Mcp/Program.cs Updated MCP tool to accept AnalysisOptions parameter with Description attribute
src/ProjGraph.Cli/Commands/ClassDiagramCommand.cs Updated CLI command to construct AnalysisOptions from settings
tests/ProjGraph.Tests.Contract/McpClassDiagramTests.cs Updated contract tests to verify new MCP signature
tests/ProjGraph.Tests.Unit.ClassDiagram/*.cs Updated unit tests to use new AnalysisOptions constructor
tests/ProjGraph.Tests.Integration.Mcp/McpClassDiagramTests.cs Updated integration tests with AnalysisOptions instances
specs/004-config-class-members/data-model.md Whitespace/formatting cleanup
CONTRIBUTING.md Removed NullOutputConsole from shared helpers list (no longer exists)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HandyS11 HandyS11 merged commit cd99fc7 into develop Feb 17, 2026
3 checks passed
@HandyS11 HandyS11 deleted the fix/sonar-issue-mcp branch February 17, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant