Fix SonarQube high-severity issues for Go code quality #31
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.



Summary
This PR addresses SonarQube high-severity issues related to string literal duplication and cognitive complexity in Go code.
Link to Devin run: https://app.devin.ai/sessions/7cbbfdb1cb6c4c04b1870495fcafc0d1
Requested by: @eashansinha
Changes Made
String Literal Duplication Fixes
"stdio-server-cmd"string to constantflagStdioServerCmdextractPRFilesParams()helper to eliminate duplicated parameter extraction codeCognitive Complexity Reduction
main()toloadSchemaAndPopulateTools()functionGetPullRequestFiles()by using parameter extraction helperCritical: The
loadSchemaAndPopulateTools()function silently ignores all errors and returns without indication of failure. This was done to maintain backward compatibility with the original code that also ignored these errors, but reviewers should verify this is the intended behavior.Testing: These changes primarily affect utility functions and CLI code that may have limited test coverage. Manual testing of the
mcpcurlCLI tool is recommended.Error Handling: The
extractPRFilesParams()helper changes the error handling flow slightly from the original inline code - please verify the behavior is identical.Tradeoffs
Alternatives Considered
loadSchemaAndPopulateTools(), but this would change existing CLI behaviorTesting
✅
go fmt ./...- All code properly formatted✅
go build ./...- Builds successfully✅
go test ./...- All tests passManual testing needed: CLI functionality with
mcpcurltool to ensure schema loading still works correctly.