Skip to content

Conversation

leagris
Copy link

@leagris leagris commented Jul 31, 2022

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...

leagris added 2 commits July 31, 2022 16:03
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
Copy link
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.

leagris added 2 commits August 1, 2022 21:38
Replace process substitution by named fifo and background process
replace mapfile with read -a
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