🧪 [testing improvement] Lint shell scripts with ShellCheck#118
Open
keeganwitt wants to merge 1 commit intogroovy:masterfrom
Open
🧪 [testing improvement] Lint shell scripts with ShellCheck#118keeganwitt wants to merge 1 commit intogroovy:masterfrom
keeganwitt wants to merge 1 commit intogroovy:masterfrom
Conversation
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>
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.
Identified and fixed several issues in
generate-stackbrew-library.sh,update.sh, andtest/run.shto improve code quality and reliability.Key changes:
generate-stackbrew-library.sh:commitvariable was overwritten inside a loop, potentially affecting subsequent iterations.evalwithmapfilefor more robust and secure array population fromjqoutput.sedwith Bash parameter expansion for more efficient trailing whitespace removal.update.sh:sed --versioncheck for better compatibility.test/run.sh:id -ucommand substitution.These changes align the codebase with ShellCheck best practices and improve overall script robustness.