Skip to content

fix: shellcheck - add quotes and remove unused variable#55

Open
vlordier wants to merge 1 commit intoLiquid4All:mainfrom
vlordier:fix/shellcheck-fixes
Open

fix: shellcheck - add quotes and remove unused variable#55
vlordier wants to merge 1 commit intoLiquid4All:mainfrom
vlordier:fix/shellcheck-fixes

Conversation

@vlordier
Copy link
Copy Markdown

@vlordier vlordier commented Mar 6, 2026

Summary

  • smoke-test.sh: quote $servers in two npx tsx calls (SC2086)
  • validate-mcp-servers.sh: remove unused implemented_tools variable (SC2034)

No more shellcheck errors or warnings in these scripts.

- smoke-test.sh: quote $servers in two npx tsx calls
- validate-mcp-servers.sh: remove unused implemented_tools variable

No more shellcheck errors or warnings.
Copilot AI review requested due to automatic review settings March 6, 2026 18:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses shellcheck warnings in two shell scripts within the examples/localcowork/scripts/ directory. It also normalizes indentation from spaces to tabs throughout both files.

Changes:

  • smoke-test.sh: Quotes $servers in two npx tsx invocations to fix SC2086, and normalizes indentation from spaces to tabs.
  • validate-mcp-servers.sh: Removes the unused implemented_tools variable (SC2034), and normalizes indentation from spaces to tabs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
examples/localcowork/scripts/smoke-test.sh Indentation normalized to tabs; $servers quoted in two npx tsx calls to silence SC2086
examples/localcowork/scripts/validate-mcp-servers.sh Indentation normalized to tabs; removed unused implemented_tools variable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Run the contract validator if it exists
if [ -f "$SMOKE_DIR/contract-validator.ts" ]; then
local output
if output=$(cd "$PROJECT_ROOT" && npx tsx "$SMOKE_DIR/contract-validator.ts" "$servers" 2>&1); then
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Quoting "$servers" here passes the entire space-separated list of server names as a single argument to contract-validator.ts. The find_implemented_servers function (line 148) returns a space-separated string like "filesystem calendar contacts". Without quotes, shell word-splitting correctly expands this into separate positional arguments. With quotes, the TypeScript script receives one argument containing all names joined by spaces.

Note that just 15 lines below (line 214), $servers is intentionally left unquoted in for server_name in $servers to get the correct word-splitting behavior — these two usages should be consistent.

The proper shellcheck-compliant fix would be to convert servers to an array: use read -ra servers <<< "$(find_implemented_servers)" and then pass "${servers[@]}" to the npx call and the for loop.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

# Run the health checker if it exists
if [ -f "$SMOKE_DIR/server-health.ts" ]; then
local output
if output=$(cd "$PROJECT_ROOT" && npx tsx "$SMOKE_DIR/server-health.ts" "$servers" 2>&1); then
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Same issue as in run_contract_tests — quoting "$servers" passes the entire space-separated list of server names as a single argument to server-health.ts instead of separate arguments. This will break when there are multiple implemented servers. See the comment on line 199 for the recommended fix using arrays.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

@vlordier
Copy link
Copy Markdown
Author

vlordier commented Mar 6, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

vlordier added a commit to vlordier/cookbook that referenced this pull request Mar 6, 2026
- Add GitHub Actions workflow for shellcheck
- Add shellcheck validation to pre-commit hook for staged .sh files

This improves on PR Liquid4All#55 by adding automated shellcheck validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants