Final SonarCloud Cleanup - #5
Conversation
📝 WalkthroughWalkthroughReplaces POSIX test expressions with Bash [[...]] in shell scripts, makes small output/return adjustments, and refactors TypeScript by extracting helpers, renaming methods, and tightening regex construction and command-name resolution—no public API changes. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Fix all issues with AI agents
In `@docs/install.sh`:
- Around line 20-24: In the error() function, the trailing "return 1" is
unreachable because "exit 1" immediately terminates the script; remove the
"return 1" statement from error() (or if you intended the function to return
instead of exiting, replace "exit 1" with "return 1") so the function's control
flow is correct—locate the error() function and either delete the return line or
swap the exit to a return depending on desired behavior.
- Around line 26-38: The info, info_bold, and success functions misuse $@ inside
a quoted string which triggers ShellCheck SC2145 and can split arguments
incorrectly; change the argument expansion so arguments are joined safely (e.g.
replace $@ with "$*" or move "$@" outside the surrounding string) and quote
expansions to preserve whitespace — update the three functions (info, info_bold,
success) to use a safe expansion like echo -e "${Dim}$* ${Color_Off}" (or echo
-e "${Dim}" "$@" "${Color_Off}") so multiple arguments are handled consistently.
In `@src/cli.ts`:
- Around line 161-162: The code uses String.raw for the ANSI escape sequence,
which prevents \x1b from being interpreted so colors print as literal text; in
the console.error call where tty is computed (variable tty and the console.error
line), replace the String.raw template with a normal template literal so the ESC
byte is interpreted (e.g., use `\x1b[32m${msg}\x1b[0m` or
`\u001b[32m${msg}\u001b[0m`) when tty is true, leaving the plain msg when tty is
false.
- Around line 126-128: The prompt uses String.raw which prevents escape
sequences like \n from becoming real newlines; change the promptMsg declaration
to use a normal template literal (remove String.raw) so the leading `\n` and any
other escapes are interpreted as actual newlines and the message displays
correctly; update the const promptMsg used in rl.question accordingly.
In `@src/parser/rules/CoreAstRule.ts`:
- Around line 83-92: resolveCmdName currently treats a leading backslash
specially and keeps the full path (e.g. "/usr/bin/rm") which prevents proper
basename extraction and blocked-command detection; change the logic to first
strip a single leading backslash (if any) into a local variable (e.g. stripped =
entry.startsWith("\\") ? entry.slice(1) : entry), then compute basename =
stripped.split("/").pop() ?? "", call this.resolveVarToken(basename, vars), and
if resolvedVar is returned take resolvedVar.split("/").pop()?.toLowerCase() ??
"" else return basename.toLowerCase(); ensure you update uses of cmdName to use
these variables so both escaped paths and resolved variables are evaluated by
basename extraction and lowercased.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ea86a377b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|



Summary
CoreAstRule,git.tsandvalidators.tsto ensure strict compliance with Cognitive Complexity limits.[to[[constructs in bash scripts and ensured syntax validity (verified withbash -n).String.raw, unnecessary escapes, and control characters.This PR aims to reach 0 issues on SonarCloud.
Summary by CodeRabbit