[hermes] metis: go:S3776 #210
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 three independent concerns (mount health, device identity via blkid, and bind-target health) in one method, and the accumulated nested ifs and loop push its cognitive complexity to 17. Extracting each concern into a small helper keeps the exact same behaviour while dropping the method well under the threshold.
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— Replace the body of collectUSBScratch with three sequential helper calls, moving the mount-health block, the device/blkid block (with device resolution order source -> UUID -> label preserved), and the bind-target loop into dedicated functions. Each helper performs exactly the statements the original method did, in the same order and with the same conditions, so the produced facts.USBScratch is identical; only the complexity accounting changes because the nesting now lives in small single-purpose functions.Links
/api/admin/audit/events, event typeshermes_autotriage_incidentandhermes_autotriage_diagnosis.Filed automatically by Ariadne from a Hermes Agent diagnosis (run run_48ec45dee2f341e4b202aa4beabfb6d7). Hermes has no write access to this repository; no files or infrastructure were changed.