Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(completion): fix static analysis shellcheck errors #1108

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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

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...
contrib/completion/bash/sdk Outdated Show resolved Hide resolved
contrib/completion/bash/sdk Outdated Show resolved Hide resolved
@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.

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.

None yet

2 participants