fix(security): remediate SonarQube vulnerabilities#79
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
fix(security): remediate SonarQube vulnerabilities#79devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
- S1192 in main.go: Extract constant 'readOnlyKey' for duplicated 'read-only' string - S1192 in error.go: Extract error variable for duplicated context error message - S3776 in generate_docs.go: Reduce cognitive complexity by extracting helper functions - extractPropertyType: handles type extraction from property map - extractArrayType: handles array item type extraction - extractPropertyDescription: handles description extraction - formatParamLine: formats parameter documentation line - getSortedParamNames: returns sorted parameter names Co-Authored-By: parker.duff@codeium.com <pwjduff@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
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.



Closes: N/A (SonarQube remediation task)
Summary
This PR addresses 3 high-severity SonarQube issues:
cmd/github-mcp-server/main.goreadOnlyKeyconstantpkg/errors/error.goerrContextMissingGitHubCtxErrorserror variablecmd/github-mcp-server/generate_docs.goChanges
main.go: Simple constant extraction for the
"read-only"configuration key.error.go: Replaced
fmt.Errorf("...")with a package-level error variable usingerrors.New(). This is more idiomatic Go for static error messages and also satisfies staticcheck SA1006.generate_docs.go: Refactored
generateToolDocby extracting 5 helper functions:extractPropertyType/extractArrayType- type extraction logicextractPropertyDescription- description extractionformatParamLine- parameter line formattinggetSortedParamNames- sorted parameter name collectionHuman Review Checklist
generateToolDocrefactoring preserves exact output behavior (the nested type-checking logic was the main complexity source)generateToolDocis equivalent to original if-else structureTesting
Link to Devin run: https://app.devin.ai/sessions/379edd90ee8244c5b468b760d21cc62c
Requested by: @parkerduff