Skip to content

fix: extract constant for duplicated GQL client error string (go:S1192) - #140

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1776698078-fix-duplicated-string-literal
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1776698078-fix-duplicated-string-literal

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Apr 20, 2026

Copy link
Copy Markdown

Closes SonarQube issue AZhX1hJ3UiHWiWeaJF-T (rule go:S1192 — duplicated string literals, CRITICAL).

What

Defines an unexported constant errFailedToGetGQLClient for the string "failed to get GitHub GQL client: %v", which was duplicated 4 times across ListDiscussions, GetDiscussion, GetDiscussionComments, and ListDiscussionCategories in pkg/github/discussions.go.

Why

SonarQube flagged this as a CRITICAL maintainability issue — duplicated string literals make refactoring error-prone since changes must be propagated to every occurrence.

Review checklist

  • Confirm the constant name/casing follows project conventions (unexported, err-prefixed)
  • Verify no other files in pkg/github/ duplicate this same literal (this PR only addresses discussions.go per the SonarQube finding)
  • No behavioral change — purely mechanical refactor

Link to Devin session: https://app.devin.ai/sessions/64c1809b174b44f4a6b5f6ef99e66434
Requested by: @eashansinha


Open in Devin Review

Define errFailedToGetGQLClient constant to replace 4 duplicated
occurrences of "failed to get GitHub GQL client: %v" in
discussions.go, resolving SonarQube go:S1192 (CRITICAL).

Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant