fix: add asdf to list of banned commands (#1224)

Ban recusive asdf calls as they are inefficient and may introduce bugs.
If you find yourself needing to invoke an `asdf` command from within
asdf code, please source the appropriate file and invoke the
corresponding function.
This commit is contained in:
Trevor Brown 2022-05-06 09:21:06 -04:00 committed by GitHub
parent a9caa5bdff
commit 39909e01af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -13,7 +13,7 @@ asdf() {
;;
*)
# forward other commands to asdf script
command asdf "$command" "$@"
command asdf "$command" "$@" # asdf_allow: ' asdf '
;;
esac

View File

@ -97,7 +97,7 @@ write_shim_script() {
cat <<EOF >"$shim_path"
#!/usr/bin/env bash
# asdf-plugin: ${plugin_name} ${version}
exec $(asdf_dir)/bin/asdf exec "${executable_name}" "\$@"
exec $(asdf_dir)/bin/asdf exec "${executable_name}" "\$@" # asdf_allow: ' asdf '
EOF
fi

View File

@ -41,6 +41,12 @@ banned_commands_regex=(
# match certain filename patterns.
# https://github-wiki-see.page/m/koalaman/shellcheck/wiki/SC2012
'\bls '
# Ban recusive asdf calls as they are inefficient and may introduce bugs.
# If you find yourself needing to invoke an `asdf` command from within
# asdf code, please source the appropriate file and invoke the
# corresponding function.
'\basdf '
)
setup() {