fix(security): remediate SonarQube vulnerabilities in notifications.go#85
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
fix(security): remediate SonarQube vulnerabilities in notifications.go#85devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
- S1192: Define constants for duplicated string literals - errFailedToGetGitHubClient (6 occurrences) - errFailedToReadResponseBody (4 occurrences) - errFailedToMarshalResponse (4 occurrences) - S3776: Reduce cognitive complexity by extracting helper functions - ListNotifications: Extract extractListNotificationsParams, buildNotificationListOptions, fetchNotifications, handleNotificationResponse - DismissNotification: Extract dismissNotificationByState, handleDismissResponse - MarkAllNotificationsRead: Extract extractMarkAllNotificationsReadParams, parseLastReadAtTime, markNotificationsRead, handleMarkAllReadResponse - ManageNotificationSubscription: Extract executeThreadSubscriptionAction, handleSubscriptionResponse - ManageRepositoryNotificationSubscription: Extract executeRepoSubscriptionAction, handleRepoSubscriptionResponse All tests pass and lint checks pass. 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 remediates 8 high-severity SonarQube issues in
pkg/github/notifications.go:Changes
S1192 - Duplicated String Literals: Defined package-level constants for repeated error message format strings:
errFailedToGetGitHubClient(was duplicated 6 times)errFailedToReadResponseBody(was duplicated 4 times)errFailedToMarshalResponse(was duplicated 4 times)S3776 - Cognitive Complexity: Extracted helper functions from complex handlers:
ListNotifications: ExtractedextractListNotificationsParams,buildNotificationListOptions,fetchNotifications,handleNotificationResponseDismissNotification: ExtracteddismissNotificationByState,handleDismissResponseMarkAllNotificationsRead: ExtractedextractMarkAllNotificationsReadParams,parseLastReadAtTime,markNotificationsRead,handleMarkAllReadResponseManageNotificationSubscription: ExtractedexecuteThreadSubscriptionAction,handleSubscriptionResponseManageRepositoryNotificationSubscription: ExtractedexecuteRepoSubscriptionAction,handleRepoSubscriptionResponseTradeoffs
//nolint:revive,staticcheckdirectives for user-facing error messages that intentionally use capitalization and punctuation for readability. These messages are returned viamcp.NewToolResultError()to end users.Review Checklist
resp == nilchecks inDismissNotificationandManageNotificationSubscription)Link to Devin run: https://app.devin.ai/sessions/54ba9cca37174996ae02a562cdf0d0f8
Requested by: @parkerduff