[hermes] metis: go:S3776 #157
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
pkg/sentinel/collector.go. The build is green; this is a standing finding, not a failure.What is wrong
collectUSBScratch mixes mount-health checks, device resolution/blkid health checks, and bind-target evaluation (with nested ifs, &&, and an else) all in one function body, pushing cognitive complexity to 17. Extracting the device-resolution/health logic and the bind-target loop into small helper functions removes nesting levels and the else branch without changing any outcome.
Ariadne opened no pull request for it: no automated patch was possible for this finding.
Facts
pkg/sentinel/collector.go:131)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.
pkg/sentinel/collector.go— Split collectUSBScratch into itself plus three small helpers (resolveDevice, applyDeviceHealth, collectBindTargets). Each helper keeps the exact same conditions and order of operations, but moving them out lowers nesting depth and removes the else branch (replaced by an early return), bringing the parent function's cognitive complexity under 15 while every field is still set the same way.Links
/api/admin/audit/events, event typeshermes_autotriage_incidentandhermes_autotriage_diagnosis.Filed automatically by Ariadne from a Hermes Agent diagnosis (run run_04939157451949df92692517fa2bc1eb). Hermes has no write access to this repository; no files or infrastructure were changed.