Skip to content
joinery / docs

SonarQube code smells: scripts

Closed

docs/audits/2026-09-25-sonarqube-scripts.md · read at 88f5939

Open
0
Fixed
14
Won't fix
0

🔎 SonarQube code smells: scripts

Context

SonarQube Cloud reported 14 open code smells for infrastructure/scripts on master on 2026-09-25. Each flagged line was checked against commit 88f5939; the issue keys identify the original findings. The fixes pass the scripts project tests, lint and typecheck.

Quality

IDWhereSeverity and issueWhat goes wrongFixStatus
Q1issue/adapters/gh.ts:84Critical AaBpoHA5_jgBJHByMPAIvoid gh(...) discards a synchronous result with the void operator.Use a block-bodied void function and call gh(...) as a statement; verify errors still propagate.fixed
Q2issue/adapters/gh.ts:88Critical AaBpsCFV2q7RbhuE3wBkBranch creation repeats the same void pattern.Apply Q1's block-bodied form to developBranch.fixed
Q3issue/adapters/gh.ts:92Critical AaB38bfP50elM9qDIsBZProject-status updates repeat the same void pattern.Apply Q1's block-bodied form to moveToInProgress.fixed
Q4issue/adapters/git.ts:9Critical AaBtJzn-TKt27OlRUvfVCheckout discards the command result with void.Call git("checkout", branch) in a block-bodied void function; keep command failure behavior.fixed
Q5package-contracts/domain/validate.ts:205Critical AaDFDh5nEA0Bk8tS9EXVvalidatePackage combines manifest guards, exports, peer metadata and tags, crossing the complexity limit.Extract export and peer-dependency validation into focused helpers that append to the same error and skipped lists; retain current error ordering in specs.fixed
Q6issue/domain/branch.ts:12Major AaBpoHBb_jgBJHByMPAKThe trim regex can backtrack on a long all-hyphen slug.Trim leading and trailing hyphens with a linear scan or two anchored replacements; cover empty and long punctuation-only names.fixed
Q7package-contracts/adapters/files.ts:14Minor AaDFDh77EA0Bk8tS9EXWsplit("\\").join("/") creates an array to normalize a path.Use .replaceAll("\\", "/"); retain Windows-path coverage.fixed
Q8package-contracts/domain/validate.ts:23Minor AaDFDh5nEA0Bk8tS9EXTA ternary restates the undefined fallback after JSON.stringify.Use rendered ?? String(value); keep undefined and symbol cases covered.fixed
Q9package-contracts/domain/validate.ts:73Minor AaDFDh5nEA0Bk8tS9EXUThe replacement text escapes a backslash in an ordinary string.Use String.raw for the replacement while keeping the produced regex unchanged.fixed
Q10shared/domain/layout.ts:4Minor AaDAU-A_y0vepUx4FnAWAcronym membership uses an array scan.Make ACRONYMS a Set and use .has() in titleCase.fixed
Q11review-version/domain/manifest.spec.ts:81Minor AaCkZBKMv8--a__ZffrMComparing .length hides the relevant collection when the assertion fails.Assert toHaveLength(METHOD_ARTIFACTS.length) on the filtered lines.fixed
Q12map/adapters/files.ts:76Minor AaCFksdWXFUGTcAAmGOXIgnored-directory membership uses an array scan.Make IGNORED_DIRS a Set and use .has() at the walk site.fixed
Q13map/domain/capabilities.ts:65Minor AaBsdAgrc4poDHW_U8-zThe regex-escape replacement uses a doubly escaped replacement string.Use String.raw for the replacement; assert punctuation tokens still match literally.fixed
Q14map/domain/capabilities.ts:66Minor AaBsdAgrc4poDHW_U8-0The dynamic regex also escapes character classes inside a template string.Use String.raw for the pattern template and preserve boundary behavior.fixed

Order

Address Q6 and Q5 with focused regression cases, then Q1–Q4 together because they share one adapter pattern. The remaining findings are local substitutions; run the scripts project specs, lint and typecheck after those edits.