Skip to content

Commit

Permalink
fix: add asdf to list of banned commands (#1224)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Stratus3D authored May 6, 2022
1 parent a9caa5b commit 39909e0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/asdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ asdf() {
;;
*)
# forward other commands to asdf script
command asdf "$command" "$@"
command asdf "$command" "$@" # asdf_allow: ' asdf '
;;

esac
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/reshim.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions test/banned_commands.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 39909e0

Please sign in to comment.