From 3f4a57923d4d4b172bf323764fa49e8c524c498d Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 22 Aug 2022 21:50:17 +0900 Subject: [PATCH] Add .shellcheckrc --- .shellcheckrc | 14 ++++++++++++++ main.sh | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 .shellcheckrc diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 00000000..9de7d943 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,14 @@ +# ShellCheck configuration +# https://github.com/koalaman/shellcheck/blob/HEAD/shellcheck.1.md#rc-files + +# See also: +# https://www.shellcheck.net/wiki/Optional +# https://google.github.io/styleguide/shellguide.html + +# https://www.shellcheck.net/wiki/SC2292 +# https://google.github.io/styleguide/shellguide.html#s6.3-tests +enable=require-double-brackets + +# https://www.shellcheck.net/wiki/SC2250 +# https://google.github.io/styleguide/shellguide.html#s5.6-variable-expansion +enable=require-variable-braces diff --git a/main.sh b/main.sh index 48e8e606..74716911 100755 --- a/main.sh +++ b/main.sh @@ -123,8 +123,8 @@ cargo_binstall() { # As a result, http will be disabled, and it will also set # min tls version to be 1.2 case "${version}" in - latest) cargo binstall --force --secure --no-confirm "$tool" ;; - *) cargo binstall --force --secure --no-confirm --version "$version" "$tool" ;; + latest) cargo binstall --force --secure --no-confirm "${tool}" ;; + *) cargo binstall --force --secure --no-confirm --version "${version}" "${tool}" ;; esac } @@ -146,7 +146,7 @@ case "${OSTYPE}" in cygwin* | msys*) exe=".exe" ;; esac -cargo_bin="${CARGO_HOME:-"$HOME/.cargo"}/bin" +cargo_bin="${CARGO_HOME:-"${HOME}/.cargo"}/bin" if [[ ! -d "${cargo_bin}" ]]; then cargo_bin=/usr/local/bin fi