[hermes] ananke: go:S1192 #176

Open
opened 2026-09-23 06:21:45 +00:00 by hermes-automation · 0 comments

SonarQube reports go:S1192 in internal/cluster/orchestrator_longhorn_reconcile.go. The build is green; this is a standing finding, not a failure.

What is wrong

The literal "longhorn-system" namespace string is hard-coded separately in three kubectl invocations (queryLonghornNodes, queryLonghornManagerDaemonSet, longhornManagerPodsByNode), tripping S1192's duplicate-literal rule. Extracting it to a single package-level constant removes the duplication without altering any behavior.

Ariadne opened no pull request for it: no automated patch was possible for this finding.

Facts

  • gitea — Define a constant instead of duplicating this literal "longhorn-system" 3 times. (CRITICAL, 6min estimated) (internal/cluster/orchestrator_longhorn_reconcile.go:136)

Suggested fix (not applied)

Hermes could not open a pull request for this, so the change below was not written, validated, or pushed anywhere. It is a starting point for whoever picks this up, not a reviewed patch.

internal/cluster/orchestrator_longhorn_reconcile.go — Add a package-level constant for the Longhorn namespace and reference it at all three call sites that currently repeat the "longhorn-system" string literal. This satisfies S1192 while keeping the exact same kubectl arguments.

// Add near the top of the file, after the type declarations:
const longhornSystemNamespace = "longhorn-system"

// In queryLonghornNodes, replace:
//   out, err := o.kubectl(ctx, 30*time.Second, "-n", "longhorn-system", "get", "nodes.longhorn.io", "-o", "json")
// with:
	out, err := o.kubectl(ctx, 30*time.Second, "-n", longhornSystemNamespace, "get", "nodes.longhorn.io", "-o", "json")

// In queryLonghornManagerDaemonSet, replace:
//   out, err := o.kubectl(ctx, 20*time.Second, "-n", "longhorn-system", "get", "daemonset", "longhorn-manager", "-o", "json")
// with:
	out, err := o.kubectl(ctx, 20*time.Second, "-n", longhornSystemNamespace, "get", "daemonset", "longhorn-manager", "-o", "json")

// In longhornManagerPodsByNode, replace:
//   args := []string{"-n", "longhorn-system", "get", "pods", "-o", "json"}
// with:
	args := []string{"-n", longhornSystemNamespace, "get", "pods", "-o", "json"}

Filed automatically by Ariadne from a Hermes Agent diagnosis (run run_ab85c64a901341e48f4a24ddf99bfdac). Hermes has no write access to this repository; no files or infrastructure were changed.

SonarQube reports **go:S1192** in `internal/cluster/orchestrator_longhorn_reconcile.go`. The build is green; this is a standing finding, not a failure. ## What is wrong The literal "longhorn-system" namespace string is hard-coded separately in three kubectl invocations (queryLonghornNodes, queryLonghornManagerDaemonSet, longhornManagerPodsByNode), tripping S1192's duplicate-literal rule. Extracting it to a single package-level constant removes the duplication without altering any behavior. Ariadne opened no pull request for it: no automated patch was possible for this finding. ## Facts - **gitea** — Define a constant instead of duplicating this literal "longhorn-system" 3 times. (CRITICAL, 6min estimated) (`internal/cluster/orchestrator_longhorn_reconcile.go:136`) ## Suggested fix (not applied) Hermes could not open a pull request for this, so the change below was not written, validated, or pushed anywhere. It is a starting point for whoever picks this up, not a reviewed patch. **`internal/cluster/orchestrator_longhorn_reconcile.go`** — Add a package-level constant for the Longhorn namespace and reference it at all three call sites that currently repeat the "longhorn-system" string literal. This satisfies S1192 while keeping the exact same kubectl arguments. ``` // Add near the top of the file, after the type declarations: const longhornSystemNamespace = "longhorn-system" // In queryLonghornNodes, replace: // out, err := o.kubectl(ctx, 30*time.Second, "-n", "longhorn-system", "get", "nodes.longhorn.io", "-o", "json") // with: out, err := o.kubectl(ctx, 30*time.Second, "-n", longhornSystemNamespace, "get", "nodes.longhorn.io", "-o", "json") // In queryLonghornManagerDaemonSet, replace: // out, err := o.kubectl(ctx, 20*time.Second, "-n", "longhorn-system", "get", "daemonset", "longhorn-manager", "-o", "json") // with: out, err := o.kubectl(ctx, 20*time.Second, "-n", longhornSystemNamespace, "get", "daemonset", "longhorn-manager", "-o", "json") // In longhornManagerPodsByNode, replace: // args := []string{"-n", "longhorn-system", "get", "pods", "-o", "json"} // with: args := []string{"-n", longhornSystemNamespace, "get", "pods", "-o", "json"} ``` ## Links - SonarQube finding: https://quality.bstein.dev/project/issues?resolved=false&id=ananke&open=AZ-IckL-1fRfbdzqD-5R - Full evidence bundle and audit trail live in Ariadne at `/api/admin/audit/events`, event types `hermes_autotriage_incident` and `hermes_autotriage_diagnosis`. Filed automatically by Ariadne from a Hermes Agent diagnosis (run [run_ab85c64a901341e48f4a24ddf99bfdac](https://triage.bstein.dev/chat?resume=run_ab85c64a901341e48f4a24ddf99bfdac)). Hermes has no write access to this repository; no files or infrastructure were changed. <!-- hermes-triage job=ananke classification=go:S1192 incident=sonar/ananke/go:S1192/AZ-IckL-1fRfbdzqD-5R -->
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: titan/ananke#176
No description provided.