[hermes] metis: go:S3776 #385
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 concerns in one function body — mount/filesystem health checks, device identity resolution via blkid, and bind-target evaluation in a loop with a nested conditional — pushing cognitive complexity to 17 via accumulated nesting and boolean operators. Extracting the device-identity resolution and the bind-target loop into their own functions removes two of the deepest nesting contributors without changing behavior.
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— Extract the device/UUID/Label resolution and blkid export logic (previously inline ifs operating ondevice) into resolveUSBScratchIdentity, and extract the BindTargets loop (for + nested if) into evaluateBindTargets. collectUSBScratch now just sequences three straightforward steps, dropping its cognitive complexity well under 15 while every branch and return value stays identical.Links
/api/admin/audit/events, event typeshermes_autotriage_incidentandhermes_autotriage_diagnosis.Filed automatically by Ariadne from a Hermes Agent diagnosis (run run_25e8d2dbc3284518b88eb87fdd4f0442). Hermes has no write access to this repository; no files or infrastructure were changed.