chore(sonar): clean up maintainability + reliability smells#14
Merged
Conversation
Track A — fix in code (the unambiguous mechanical wins): - 21 reliability-impact smells: replaceAll over replace, role="list" removed from <ul>/<ol> (implicit by HTML), Number.parseInt over parseInt, ambiguous JSX whitespace tightened. - 19 typescript:S7764: window→globalThis (timer refs typed as ReturnType<typeof setTimeout> to satisfy DOM/Node ambiguity). - 26 go:S1192: extracted package-local constants for repeated string literals (.jsonl, Content-Type/application/json/Cache-Control/no-store, POST only, auth/input log labels, error-message templates, display-message tmux subcommand, %q-not-found, color-wrap %s%s%s\\n). - Misc small wins: arr.at(-1) over arr[length-1], optional chaining, removed unnecessary type assertions, blank-import comment for go-sqlite3. Track B — bulk-accept workflow for remaining smells: .github/workflows/sonar-bulk-accept.yml is a workflow_dispatch job (default dry_run=true) that calls SonarCloud's bulk_change API to mark the remaining smells as Accepted with a per-bucket comment: - typescript:S6759 readonly props (project style) - typescript:S6819 role=status, S3358 nested ternary, S6571 redundant type, S6754 useState style, S6479 array-index keys, S3735 void, S1874 deprecation, S7763 export-from, S7718 set-has, S6772 ambiguous spacing (remaining), S6582 chain (remaining), S4624 nested template literals, S6822 implicit list (remaining), S1871 duplicate case - godre:S8205 named struct, S8196 interface naming, S8193 receiver, S8242 ctx field, go:S107/S117 signature - All test-file CODE_SMELL findings (table-driven density is by design) - godre:S8239 marked False Positive: shutdown handler intentionally uses context.Background() because the parent ctx is already Done at that point (deriving would give zero-grace shutdown). go build/test green (918 pass, 27 pkgs); UI tsc + vitest green (206 pass, 29 files). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2 tasks
aksOps
added a commit
that referenced
this pull request
May 1, 2026
After PR #14 merged, four typescript:S7741 smells appeared on main — a side effect of `typeof globalThis.window === "undefined"` (carried over verbatim from the original `typeof window` SSR guards). Now that we go through globalThis, the property access yields undefined safely without typeof, so the typeof is genuinely redundant. Replaced with direct `globalThis.window === undefined` in 4 sites. Also adds a go:S3776 / typescript:S3776 bucket to the bulk-accept workflow. Remaining occurrences are HTTP handlers / tailers / engines where complexity is breadth of cases (auth, decode, validate, dispatch, error) rather than nesting — extracting helpers used once would add indirection without reducing reader load. Accepted as project-wide judgement call rather than per-function. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Acts on the user's request: address remaining maintainability + reliability smells. Where I'm 100% sure something is not a concern, the bundled bulk-accept workflow marks it Accepted (or False Positive for the one rule misfire).
Track A — code fixes (66 smells fixed mechanically):
context.Background()use in shutdown — bulk workflow marks it False Positive).replaceAlloverreplacerole="list"from<ul>/<ol>Number.parseIntoverparseIntwindow→globalThis. Timer refs typed asReturnType<typeof setTimeout>to bridge DOM/Node typing..jsonl,Content-Type/application/json/Cache-Control/no-store,POST only, error-message templates,display-message,session %q not found, color-wrap fmt.arr.at(-1), optional chaining, removed unnecessary type assertions, comment on_ \"github.com/mattn/go-sqlite3\"blank import.Track B — bulk-accept workflow (the remaining ~190 smells):
.github/workflows/sonar-bulk-accept.yml(workflow_dispatch, defaultdry_run=true) calls SonarCloud's/api/issues/bulk_changeper bucket with a per-bucket justification comment. Buckets cover:Run with
dry_run=false(workflow_dispatch input) to apply.Verification:
go build -tags sqlite_fts5 ./...cleango test -tags sqlite_fts5 ./...— 918 pass across 27 packagespnpm exec tsc --noEmitcleanpnpm exec vitest run— 206 pass across 29 filesTest plan
🤖 Generated with Claude Code