[hermes] soteria: go:S3776 #56
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
SonarQube reports go:S3776 in
internal/server/metrics.go. The build is green; this is a standing finding, not a failure.What is wrong
RecordInventory nests per-PVC conditional logic (reason fallback, health flag, last-backup guards) two loops deep, pushing its cognitive complexity to 16, one over the allowed 15. Extracting the per-PVC body into a helper removes the nesting penalties without changing behaviour.
Ariadne opened no pull request for it: no automated patch was possible for this finding.
Facts
internal/server/metrics.go:133)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/server/metrics.go— The double loop plus the four conditionals inside it accumulate nesting increments that exceed the threshold. Move the per-PVC work into a private helper called from the inner loop; the loops keep the lock and reset logic, while the helper holds the straight-line conditionals at top level, dropping complexity well under 15. Behaviour is identical: the Healthy if/else collapses to a value pre-set to 0 and flipped to 1, and the LastBackupAt continue becomes an early return. Note: adjust the helper's parameter type (shown as api.PVCInventory) to the actual element type of namespace.PVCs in the ap... (truncated)
Links
/api/admin/audit/events, event typeshermes_autotriage_incidentandhermes_autotriage_diagnosis.Filed automatically by Ariadne from a Hermes Agent diagnosis (run run_94129e3ec37c44fb9c7a6bc5f8ce51d3). Hermes has no write access to this repository; no files or infrastructure were changed.