Skip to content

fix: define constant for duplicated GQL client error string (go:S1192) - #138

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1775754421-fix-duplicated-gql-client-error-string
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1775754421-fix-duplicated-gql-client-error-string

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown

Closes: SonarQube issue AZhX1hJ3UiHWiWeaJF-T (rule go:S1192)

Summary

Defines a package-level constant errFailedToGetGQLClient for the string literal "failed to get GitHub GQL client: %v" which was duplicated 4 times across the discussion handler functions in pkg/github/discussions.go.

This is a pure refactor with no behavioral change — the formatted error messages remain identical at runtime.

Changes

  • Added unexported constant errFailedToGetGQLClient at the top of discussions.go
  • Replaced all 4 inline occurrences in ListDiscussions, GetDiscussion, GetDiscussionComments, and ListDiscussionCategories

Human Review Checklist

  • Confirm the constant value exactly matches the original literal (no typo or subtle difference)
  • Confirm all 4 call sites pass err as the format arg — no change in error formatting behavior

Link to Devin session: https://app.devin.ai/sessions/a45f9eeb845a4e87b5d03ed42e1b90f7
Requested by: @parkerduff


Open in Devin Review

Replace 4 occurrences of duplicated string literal
"failed to get GitHub GQL client: %v" with a package-level
constant errFailedToGetGQLClient.

Resolves SonarQube issue AZhX1hJ3UiHWiWeaJF-T (go:S1192).

Co-Authored-By: parker.duff@codeium.com <pwjduff@gmail.com>
@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

@sonarqubecloud

sonarqubecloud Bot commented Apr 9, 2026

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

The SonarCloud Quality Gate failure is due to 7 pre-existing godre:S8205 issues (nested anonymous structs) that were already in discussions.go before this PR. SonarCloud attributes them to this PR because the file was modified.

These are MINOR-severity issues unrelated to the go:S1192 fix in this PR. The SonarCloud check is also not marked as required, so the PR remains mergeable.

@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.

0 participants