[hermes] pegasus: go:S3776 #31
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
backend/uploads.go. The build is green; this is a standing finding, not a failure.What is wrong
sanitizeDescriptor (backend/uploads.go, line 21) has a cognitive complexity of 16, one over the allowed 15. The largest single contributor is the five-clause boolean expression that classifies each rune, which adds 4 points on top of the nested underscore-collapsing branches inside the loop.
Ariadne opened no pull request for it: no automated patch was possible for this finding.
Facts
backend/uploads.go:21)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.
backend/uploads.go— The chained (r >= 'a' && r <= 'z') || ... expression contributes 4 complexity points to sanitizeDescriptor. Extracting that predicate into a named helper drops the function from 16 to 12 while keeping behaviour identical: disallowed runes still become '_', consecutive underscores are still collapsed, the empty-input fallback to "upload" is untouched, and the 64-rune cap still applies (its mis-indented block is only re-indented, not changed). Replace the existing sanitizeDescriptor with the code below.Links
/api/admin/audit/events, event typeshermes_autotriage_incidentandhermes_autotriage_diagnosis.Filed automatically by Ariadne from a Hermes Agent diagnosis (run run_818ed3e3af9544b7a031ffa2b503f004). Hermes has no write access to this repository; no files or infrastructure were changed.