fix(completion): fix static analysis shellcheck errors#1108
Open
leagris wants to merge 4 commits intosdkman:masterfrom
Open
fix(completion): fix static analysis shellcheck errors#1108leagris wants to merge 4 commits intosdkman:masterfrom
leagris wants to merge 4 commits intosdkman:masterfrom
Conversation
In ./contrib/completion/bash/sdk line 36:
candidates=${SDKMAN_CANDIDATES[@]}
^--------^ SC2178 (warning): Variable was used as an array but is now assigned a string.
^---------------------^ SC2124 (warning): Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.
In ./contrib/completion/bash/sdk line 52:
COMPREPLY=($(compgen -W "${candidates[*]}" -- "$current_word"))
^-- SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting).
In ./contrib/completion/bash/sdk line 79:
COMPREPLY=($(compgen -W "${candidates[*]}" -- "$candidate_version"))
^-- SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting).
For more information:
https://www.shellcheck.net/wiki/SC2124 -- Assigning an array to a string! A...
https://www.shellcheck.net/wiki/SC2178 -- Variable was used as an array but...
https://www.shellcheck.net/wiki/SC2207 -- Prefer mapfile or read -a to spli...
helpermethod
reviewed
Aug 1, 2022
Member
|
Hi @leagris, I've added a few comments to your proposed changes. While these are technically correct, we highly value backwards compatibility, which some of these changes might break. |
Replace process substitution by named fifo and background process
replace mapfile with read -a
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.
For more information:
https://www.shellcheck.net/wiki/SC2124 -- Assigning an array to a string! A...
https://www.shellcheck.net/wiki/SC2178 -- Variable was used as an array but...
https://www.shellcheck.net/wiki/SC2207 -- Prefer mapfile or read -a to spli...