Repository navigation
Resolve behaviour-neutral SonarCloud code smells - #471
Merged
Merged
Conversation
- Replace nested ternaries with if/else in question.ts (row color,
reserved text-field width), background-shells.ts (completion wording)
and hooks/config.ts (manifest hook entries).
- Split nested template literals into named locals in question.ts and
skills.ts.
- Hoist unconfirmedText, confirm and followEdits out of the
askViaOverlay closure; none of them reads closure state.
- Strip dashes from random IDs with replaceAll('-', '') instead of a
global regex in monitor.ts and background-bash.ts.
Output strings, IDs and control flow are unchanged.
It reads only its argument and followEdits, which is now module-level.
|
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.



Resolves 15 of the 20 open SonarCloud findings on
mainwith behaviour-neutral rewrites.optionLinerow color andtextFieldreserved width inquestion.ts,shellCompletionTextininternal/background-shells.ts, manifest hook entries inloadPluginHooks(hooks/config.ts).question.ts(renderOptions, batch result rendering,chatResult,renderTabs) andskills.ts(plugin skill command handler,bareFormRefusal).unconfirmedText,confirmandfollowEdits(S7721) move from theaskViaOverlayclosure to module scope; they read only their arguments andmultiAnswer.toggleChecked, which calls onlyfollowEdits, moves with them.monitor.tsandbackground-bash.tsstrip dashes withreplaceAll('-', '')instead ofreplace(/-/g, '')(S7781).Output strings, generated IDs and control flow are unchanged; the existing suites for these paths pass unmodified.
The remaining five findings are not changed in code:
memory.ts:98(S7767, S7758):claudePathHashreproduces Claude Code's 32-bit string hash over UTF-16 code units to name its project directory;Math.truncandcodePointAtwould produce different directory names.monitor.ts:267(S6551):end.erroris the rejection of the bash tool'sexecute, which only ever rejects with anError; theString()branch is a fallback for theunknowntype.question.ts:134(S2301):checkbox(checked)renders a checkbox state, not an action selector.todo.ts:347(S1135): the matched word is the feature name in "Register the branch-local Todo provider", not a TODO marker.npm run checkpasses (Biome, strict tsc, knip, Vitest)Tests cover the change (existing suites; no behaviour change)