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 shellcheck issues in workflows #159

Merged

Conversation

samford
Copy link
Member

@samford samford commented Jun 12, 2024

shellcheck is reporting an SC2086 ("Double quote to prevent globbing and word splitting") issue in the update-database.yml workflow. This adds quotes around the related area to resolve the issue.

There are other shellcheck issues in handler.sh but I figured that was best left to someone who's familiar with the file and/or better at shell scripting:

In /opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh line 12:
if ! which brew >/dev/null; then return; fi
     ^---^ SC2230 (info): 'which' is non-standard. Use builtin 'command -v' instead.


In /opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh line 22:
  if test -z "${CONTINUOUS_INTEGRATION}" && test -n "${MC_SID}" -o ! -t 1
              ^-----------------------^ SC2154 (warning): CONTINUOUS_INTEGRATION is referenced but not assigned.
                                                     ^-------^ SC2154 (warning): MC_SID is referenced but not assigned.


In /opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh line 27:
    [[ -n "${ZSH_VERSION}" ]] && [[ "${ZSH_VERSION}" > "5.2" ]] &&
                                                       ^---^ SC2072 (error): Decimals are not supported. Either use integers only, or use bc or awk to compare.


In /opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh line 34:
    local txt="$(brew which-formula --explain "${cmd}" 2>/dev/null)"
          ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values.


In /opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh line 43:
    [[ -n "${ZSH_VERSION}" ]] && [[ "${ZSH_VERSION}" > "5.2" ]] &&
                                                       ^---^ SC2072 (error): Decimals are not supported. Either use integers only, or use bc or awk to compare.

For more information:
  https://www.shellcheck.net/wiki/SC2072 -- Decimals are not supported. Eithe...
  https://www.shellcheck.net/wiki/SC2154 -- CONTINUOUS_INTEGRATION is referen...
  https://www.shellcheck.net/wiki/SC2155 -- Declare and assign separately to ...

Feel free to push handler.sh fixes to this branch if you know how to address the issues and we want to handle this all in one PR.

Related to Homebrew/brew#17482

`shellcheck` is reporting an SC2086 ("Double quote to prevent
globbing and word splitting") issue in the `update-database.yml`
workflow. This adds quotes around the related area to resolve the
issue.

There are other shellcheck issues in `handler.sh` but this is a
start.
@MikeMcQuaid MikeMcQuaid merged commit 77de72d into Homebrew:master Jun 13, 2024
1 check passed
@MikeMcQuaid
Copy link
Member

thanks again @samford!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants