ci: explicitly set shell in lint & format scripts (#1391)

This commit is contained in:
James Hegedus 2022-12-23 20:40:11 +11:00 committed by GitHub
parent 33bc2e0738
commit ea18e96bc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 3 deletions

View File

@ -94,6 +94,7 @@ plugin_add_command() {
if [ -f "${plugin_path}/bin/post-plugin-add" ]; then
(
export ASDF_PLUGIN_SOURCE_URL=$source_url
# shellcheck disable=SC2030
export ASDF_PLUGIN_PATH=$plugin_path
"${plugin_path}/bin/post-plugin-add"
)
@ -153,6 +154,7 @@ update_plugin() {
if [ -f "${plugin_path}/bin/post-plugin-update" ]; then
(
# shellcheck disable=SC2031
export ASDF_PLUGIN_PATH=$plugin_path
export ASDF_PLUGIN_PREV_REF=$prev_ref
export ASDF_PLUGIN_POST_REF=$post_ref

27
scripts/format.bash Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
# check .sh files
# TODO(jthegedus): unlock this check later
# TODO shfmt --language-dialect posix --indent 2 --write \
# TODO asdf.sh \
# TODO lib/*.sh
# check .bash files
shfmt --language-dialect bash --indent 2 --write \
completions/*.bash \
bin/asdf \
bin/private/asdf-exec \
lib/utils.bash \
lib/commands/*.bash \
lib/functions/*.bash \
scripts/*.bash \
test/test_helpers.bash \
test/fixtures/dummy_broken_plugin/bin/* \
test/fixtures/dummy_legacy_plugin/bin/* \
test/fixtures/dummy_plugin/bin/*
# check .bats files
shfmt --language-dialect bats --indent 2 --write \
test/*.bats

View File

@ -2,13 +2,27 @@
set -euo pipefail
exec shellcheck -s bash -x \
asdf.sh \
# check .sh files
# TODO(jthegedus): unlock this check later
# TODO shellcheck --shell sh --external-sources \
# TODO asdf.sh \
# TODO lib/*.sh
# check .bash files
shellcheck --shell bash --external-sources \
completions/*.bash \
bin/asdf \
bin/private/asdf-exec \
lib/utils.bash \
lib/commands/*.bash \
lib/functions/*.bash \
scripts/*.bash \
test/test_helpers.bash \
test/fixtures/dummy_broken_plugin/bin/* \
test/fixtures/dummy_legacy_plugin/bin/* \
test/fixtures/dummy_plugin/bin/*
# check .bats files
# TODO(jthegedus): unlock this check later
# TODO shellcheck --shell bats --external-sources \
# TODO test/*.bats

View File

@ -2,4 +2,26 @@
set -euo pipefail
exec shfmt -d .
# check .sh files
# TODO(jthegedus): unlock this check later
# TODO shfmt --language-dialect posix --indent 2 --diff \
# TODO asdf.sh \
# TODO lib/*.sh
# check .bash files
shfmt --language-dialect bash --indent 2 --diff \
completions/*.bash \
bin/asdf \
bin/private/asdf-exec \
lib/utils.bash \
lib/commands/*.bash \
lib/functions/*.bash \
scripts/*.bash \
test/test_helpers.bash \
test/fixtures/dummy_broken_plugin/bin/* \
test/fixtures/dummy_legacy_plugin/bin/* \
test/fixtures/dummy_plugin/bin/*
# check .bats files
shfmt --language-dialect bats --indent 2 --diff \
test/*.bats