From 64f75ce22d2c8516681c79f185cdd1ce458e775b Mon Sep 17 00:00:00 2001 From: John D Pell Date: Mon, 27 Dec 2021 16:11:46 -0800 Subject: [PATCH] Revert most of "Fix linting errors that snuck in." This reverts commit 2c8ee405662d03193510f57ab44391d20628999c. - _Shellcheck_ documentation for the [`source-path`]( https://github.com/koalaman/shellcheck/wiki/Directive#source-path ) directive indicates this is correct usage. We're `source`ing the `bash-preexec.sh` file from inside the `vendor/github.com/rcaloras/bash-preexec` directory. If we used the [`source`]( https://github.com/koalaman/shellcheck/wiki/Directive#source ) directive, then the full complete path to the file itself would need to be specified. - Fix `disable=1090` to `disable=SC1090` and remove duplicate lines since this `shellcheck` directive will apply to the entire if-ladder. - Disabling `SC2154` is almost never appropriate. In this case, several `_git_bash_completion*` variables are expressly assigned in this file, so there is no "unknown" to ignore. Aside: the `${!_git_bash_completion@}` construct will expand to all variables starting with the previx `_git_bash_completion`, so this line is just a shorthand way to clear all our variables concisely without forgetting any. --- completion/available/git.completion.bash | 1 - plugins/available/autojump.plugin.bash | 4 +--- vendor/init.d/preexec.bash | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/completion/available/git.completion.bash b/completion/available/git.completion.bash index d6fd326566..31b77fa3de 100644 --- a/completion/available/git.completion.bash +++ b/completion/available/git.completion.bash @@ -39,5 +39,4 @@ done if [[ "${_git_bash_completion_found}" == false ]]; then _log_warning "no completion files found - please try enabling the 'system' completion instead." fi -# shellcheck disable=SC2154 # ignore unknown unset "${!_git_bash_completion@}" diff --git a/plugins/available/autojump.plugin.bash b/plugins/available/autojump.plugin.bash index 8969410062..3dfa0bca17 100644 --- a/plugins/available/autojump.plugin.bash +++ b/plugins/available/autojump.plugin.bash @@ -4,13 +4,11 @@ about-plugin 'Autojump configuration, see https://github.com/wting/autojump for # Only supports the Homebrew variant, Debian and Arch at the moment. # Feel free to provide a PR to support other install locations -# shellcheck disable=1090 +# shellcheck disable=SC1090 if _bash_it_homebrew_check && [[ -s "${BASH_IT_HOMEBREW_PREFIX}/etc/profile.d/autojump.sh" ]]; then source "${BASH_IT_HOMEBREW_PREFIX}/etc/profile.d/autojump.sh" elif _command_exists dpkg && dpkg -s autojump &> /dev/null; then - # shellcheck disable=SC1090 source "$(dpkg-query -S autojump.sh | cut -d' ' -f2)" elif _command_exists pacman && pacman -Q autojump &> /dev/null; then - # shellcheck disable=SC1090 source "$(pacman -Ql autojump | grep autojump.sh | cut -d' ' -f2)" fi diff --git a/vendor/init.d/preexec.bash b/vendor/init.d/preexec.bash index 25596dd608..6cfa7b0abb 100644 --- a/vendor/init.d/preexec.bash +++ b/vendor/init.d/preexec.bash @@ -8,7 +8,7 @@ # Disable immediate `$PROMPT_COMMAND` modification __bp_delay_install="delayed" -# shellcheck source=SCRIPTDIR/../github.com/rcaloras/bash-preexec +# shellcheck source-path=SCRIPTDIR/../github.com/rcaloras/bash-preexec source "${BASH_IT?}/vendor/github.com/rcaloras/bash-preexec/bash-preexec.sh" # Block damanaging user's `$HISTCONTROL`