Skip to content

🧪 [testing improvement] Lint shell scripts with ShellCheck#118

Merged
keeganwitt merged 2 commits into
groovy:masterfrom
keeganwitt:lint-shell-scripts-2118990849023491486
Mar 4, 2026
Merged

🧪 [testing improvement] Lint shell scripts with ShellCheck#118
keeganwitt merged 2 commits into
groovy:masterfrom
keeganwitt:lint-shell-scripts-2118990849023491486

Conversation

@keeganwitt

Copy link
Copy Markdown
Member

Identified and fixed several issues in generate-stackbrew-library.sh, update.sh, and test/run.sh to improve code quality and reliability.

Key changes:

  • In generate-stackbrew-library.sh:
    • Fixed a bug where the commit variable was overwritten inside a loop, potentially affecting subsequent iterations.
    • Replaced eval with mapfile for more robust and secure array population from jq output.
    • Replaced sed with Bash parameter expansion for more efficient trailing whitespace removal.
    • Added proper quoting for associative array indices and other variable expansions.
  • In update.sh:
    • Added stderr redirection to sed --version check for better compatibility.
  • In test/run.sh:
    • Added proper quoting and default values for positional parameters.
    • Quoted id -u command substitution.

These changes align the codebase with ShellCheck best practices and improve overall script robustness.

google-labs-jules Bot and others added 2 commits February 19, 2026 04:51
Identified and fixed several issues in `generate-stackbrew-library.sh`, `update.sh`, and `test/run.sh` to improve code quality and reliability.

Key changes:
- In `generate-stackbrew-library.sh`:
    - Fixed a bug where the `commit` variable was overwritten inside a loop, potentially affecting subsequent iterations.
    - Replaced `eval` with `mapfile` for more robust and secure array population from `jq` output.
    - Replaced `sed` with Bash parameter expansion for more efficient trailing whitespace removal.
    - Added proper quoting for associative array indices and other variable expansions.
- In `update.sh`:
    - Added stderr redirection to `sed --version` check for better compatibility.
- In `test/run.sh`:
    - Added proper quoting and default values for positional parameters.
    - Quoted `id -u` command substitution.

These changes align the codebase with ShellCheck best practices and improve overall script robustness.

Co-authored-by: keeganwitt <64612+keeganwitt@users.noreply.github.com>
Identified and fixed several issues in `generate-stackbrew-library.sh`, `update.sh`, and `test/run.sh` to improve code quality and reliability.

Key changes:
- In `generate-stackbrew-library.sh`:
    - Fixed a bug where the `commit` variable was overwritten inside a loop, potentially affecting subsequent iterations.
    - Replaced `eval` and `map(@sh)` with `mapfile` for more robust and secure array population, avoiding shell evaluation risks.
    - Replaced `sed` with Bash parameter expansion for more efficient trailing whitespace removal.
    - Added proper quoting for associative array indices and other variable expansions.
- In `update.sh`:
    - Added stderr redirection to `sed --version` check for better compatibility.
- In `test/run.sh`:
    - Added proper quoting and default values for positional parameters.
    - Quoted `id -u` command substitution.

These changes align the codebase with ShellCheck best practices and improve overall script robustness.

Co-authored-by: keeganwitt <64612+keeganwitt@users.noreply.github.com>
@keeganwitt
keeganwitt merged commit 0a4a392 into groovy:master Mar 4, 2026
22 checks passed
@keeganwitt
keeganwitt deleted the lint-shell-scripts-2118990849023491486 branch March 4, 2026 05:25
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.

1 participant