Fix SonarQube High severity issues: string duplication and cognitive complexity#72
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
Fix SonarQube High severity issues: string duplication and cognitive complexity#72devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
…complexity - Add refsHeadsPrefix constant to replace duplicated 'refs/heads/' string literals in repositories.go (fixes go:S1192) - Extract loadToolsFromServer function from main() in cmd/mcpcurl/main.go to reduce cognitive complexity from 18 to below 15 (fixes go:S3776) Co-Authored-By: Shannon Hittson <shannon.hittson@cognition.ai>
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 code quality improvements)
Summary
This PR addresses two High severity SonarQube issues:
go:S1192 - String literals should not be duplicated (
pkg/github/repositories.go)refsHeadsPrefixconstant for the duplicated"refs/heads/"stringDeleteFile,CreateBranch, andPushFilesfunctionsgo:S3776 - Cognitive Complexity of functions should not be too high (
cmd/mcpcurl/main.go)main()into newloadToolsFromServer()functionReview Checklist
loadToolsFromServerfunction maintains the same silent error handling behavior as the original nested conditionalsTradeoffs
The new
loadToolsFromServerfunction silently returns on errors, matching the original behavior. This is intentional as the tool loading is best-effort during CLI initialization.Link to Devin run: https://app.devin.ai/sessions/9ab56167a1a043a38e59a8728df84b80
Requested by: Shannon Hittson (@shannonhittson-eng)