Skip to content
joinery / docs

SonarQube code smells: developer portal

Closed

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

Open
0
Fixed
14
Won't fix
0

🔎 SonarQube code smells: developer portal

Context

SonarQube Cloud reported 14 code smells for this project on master on 2026-09-25. Each flagged line was checked against commit 88f5939, and all 14 findings have been fixed. The issue key identifies the exact SonarQube finding. Four separate BUG issues in this project are outside this code-smell audit.

Quality

IDWhereSeverity and issueWhat goes wrongFixStatus
Q1shared/audits.ts:34Critical AaDXsYuBE61A28_-R1h_parseFindings handles fences, headings, table headers and rows in one loop, giving cognitive complexity 22.Extract table-header detection and finding-row parsing into small functions; keep fence and heading state in the outer loop. Pin malformed and prose-table cases in the existing parser spec.fixed
Q2tools/collect/docs.ts:11Major AaB3Fi0FwgYnFLlV-z9rThe inline-link regex has overlapping paths when a long malformed link lacks a closing delimiter.Exclude nested openers from link text and destinations so failed matches cannot overlap; retain link-title and code-span cases in specs.fixed
Q3tools/collect/docs.ts:15Major AaDY6_Z_aSqI9phY3mAnThe backreference in CODE_SPAN makes unmatched runs of backticks costly to scan.Require whole backtick runs at both ends so an unmatched delimiter cannot restart at each backtick; cover multiline spans and unmatched runs.fixed
Q4shared/issues.ts:5Major AaB3Fi09wgYnFLlV-z9yLink stripping can repeatedly rescan malformed markdown.Exclude nested openers from link text and destinations so failed matches cannot overlap; preserve link text in the summary.fixed
Q5shared/issues.ts:6Major AaB3Fi09wgYnFLlV-z9zWhitespace and bullet prefixes overlap in the checkbox regex.Restrict prefix whitespace to spaces and tabs so it cannot span lines; cover long indentation and whitespace-only lines.fixed
Q6shared/issues.ts:7Major AaB3Fi09wgYnFLlV-z90The bullet regex can backtrack across long whitespace and marker runs.Restrict indentation and suffix whitespace to spaces and tabs, keeping each match on its own line.fixed
Q7tools/collect/docs.ts:180Major AaB3Fi0FwgYnFLlV-z9upages.sort(...) mutates data inside a returned object expression.Sort in a separate statement, or use pages.toSorted(...) if the workspace runtime supports it; verify page order stays the same.fixed
Q8tools/lib/scorecards.ts:52Major AaB3Fiy4wgYnFLlV-z9oThe total-row branch assigns totalDelta again when later total rows cannot change the result.Keep the first parsed Total row and return or break, or document and test last-row precedence before removing the redundant assignment.fixed
Q9shared/auditReports.ts:54Minor AaDXsYrZE61A28_-R1h9string | "all" is just string; the literal gives no type constraint.Use scope?: string, or a narrower known-scope union if the UI needs exhaustive values.fixed
Q10shared/issues.ts:53Minor AaB3Fi09wgYnFLlV-z94string | "all" collapses to string.Use label?: string, keeping the existing "all" runtime branch.fixed
Q11app/composables/useIssues.ts:1Minor AaC_Dgx3BzpILJi2DMLPThree imports from the same module are separate.Combine the value imports with a single import { ..., type IssuesRead, type GithubIssue } statement.fixed
Q12app/composables/useIssues.ts:2Minor AaC_Dgx3BzpILJi2DMLQThe second type import repeats the same module path.Resolve with Q11; keep both types in the consolidated import.fixed
Q13tools/collect/metrics.ts:23Minor AaB3FiziwgYnFLlV-z9pFiltering every tag to take the first one allocates an unnecessary array.Use .find(Boolean) and retain the null fallback.fixed
Q14tools/collect/metrics.ts:86Minor AaB3FiziwgYnFLlV-z9qFiltering every commit SHA to take the first one allocates an unnecessary array.Use .find(Boolean) and preserve the no-release branch.fixed

Order

Address Q2–Q6 first because malformed or adversarial markdown can multiply parsing time. Then split the parser in Q1, resolve Q8's total-row behavior, and take Q7 and Q9–Q14 as small cleanup changes. Run the developer portal specs, lint and typecheck after edits; use long malformed markdown cases to check that failed regex matches stay fast.