[hermes] metis: go:S3776 #323
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
parseUSBScratchFstab (line 131) reaches cognitive complexity 17 because the fstab-entry handling (empty/comment skip, field count check, bind detection, tmpfs skip, UUID=/LABEL= prefix parsing) is all nested inside the marker-block switch inside the line loop, so every condition pays a nesting penalty and the boolean operator chains add more. Extracting the per-entry handling 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
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 parseUSBScratchFstab with a version whose loop only tracks the BEGIN/END marker block and delegates each in-block line to a new helper, applyUSBScratchFstabLine, which contains the unchanged entry-parsing logic. This drops parseUSBScratchFstab to complexity ~4 and the helper to ~9, both under the limit. Behaviour is identical: the original 'continue' statements after the marker cases are redundant inside a Go switch (no fallthrough), the '!inBlock || empty || comment' skip becomes the switch only dispatching when inBlock plus the helper's early return for empty/comment lines, and every... (truncated)
Links
/api/admin/audit/events, event typeshermes_autotriage_incidentandhermes_autotriage_diagnosis.Filed automatically by Ariadne from a Hermes Agent diagnosis (run run_d91470d46cea45fbaa44bb3df8ae5970). Hermes has no write access to this repository; no files or infrastructure were changed.