fix(security): remediate SonarQube vulnerabilities#77
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
fix(security): remediate SonarQube vulnerabilities#77devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
- Extract constants for duplicated error messages in pkg/errors/error.go - Extract constants for duplicated strings in pkg/github/discussions.go - Extract constants for duplicated error messages in pkg/github/repositories.go - Extract constants for duplicated error messages in pkg/github/pullrequests.go Addresses CRITICAL severity code quality issues identified by SonarQube: - go:S1192: Define a constant instead of duplicating string literals Co-Authored-By: Eashan Sinha <eashan.sinha@codeium.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 code quality remediation)
Summary
This PR addresses SonarQube rule S1192 (duplicated string literals) by extracting repeated string literals into constants across four files. The changes are mechanical refactoring with no behavioral changes.
Changes
pkg/errors/error.go
"context does not contain GitHubCtxErrors"into a package-level error variable usingerrors.New()(4 occurrences)pkg/github/discussions.go
"Repository owner","Repository name","failed to get GitHub GQL client: %v", and"category:%s"into constantspkg/github/pullrequests.go
"failed to get pull request","failed to get current user", and"failed to get latest review for current user"into constantspkg/github/repositories.go
"failed to get GitHub client: %w","failed to create resource URI: %w", and"repo://"into constantsHuman Review Checklist
varis used forerrors.New()in error.go andconstfor string literals elsewhereVerification
./script/lintreturns 0 issues./script/testall packages OKLink to Devin run: https://app.devin.ai/sessions/a36d9c0dd05d415d95a70ee5074b5865
Requested by: Eashan Sinha (@eashansinha)