From 5508f8dc70ae885ceedcb1cbaad89fa1c3846c89 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Wed, 23 Nov 2016 20:25:38 +0800 Subject: [PATCH 1/2] [Tests] switch to use Cabal to install ShellCheck 1. This can help speed up the apt process since we decrease the complexity of apt sources and package dependencies resolving by dropping an additional ppa source. 2. Stack doesn't update ShellCheck to v0.4.5 after it has been released more than one month, Cabal can provide ShellCheck v0.4.5 --- .travis.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 22786bf295..f08ba5bbf4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ addons: apt: sources: - ubuntu-toolchain-r-test - - fpcomplete-precise - llvm-toolchain-precise - llvm-toolchain-precise-3.8 packages: @@ -12,13 +11,13 @@ addons: - g++-4.8 - clang-3.8 - lldb-3.8 - - stack - - bc + - cabal-install + - ghc - zsh - ksh cache: directories: - - $HOME/.stack + - $HOME/.cabal - $TRAVIS_BUILD_DIR/.cache before_install: - $SHELL --version 2> /dev/null || dpkg -s $SHELL 2> /dev/null || which $SHELL @@ -26,7 +25,7 @@ before_install: - wget --version - clang --version - clang++ --version - - if [ -n "${SHELLCHECK-}" ]; then stack setup && stack install ShellCheck && shellcheck --version ; fi + - if [ -n "${SHELLCHECK-}" ]; then cabal update && cabal install transformers-0.4.3.0 ShellCheck && shellcheck --version ; fi - if [ -z "${SHELLCHECK-}" ]; then sudo ln -sf /usr/bin/clang-3.8 /usr/bin/clang && sudo ln -sf /usr/bin/clang++-3.8 /usr/bin/clang++ && clang --version ; fi install: - (mkdir /tmp/urchin && cd /tmp/urchin && curl -s "$(curl -s https://registry.npmjs.com/urchin | grep -Eo '"tarball":\s*"[^"]+"' | tail -n 1 | awk -F\" '{ print $4 }')" -O && tar -x -f urchin*) @@ -39,7 +38,7 @@ env: global: - CXX=g++-4.8 - CC=gcc-4.8 - - PATH=$(echo $PATH | sed 's/::/:/') + - PATH="~/.cabal/bin/:$(echo $PATH | sed 's/::/:/')" - NVM_DIR="${TRAVIS_BUILD_DIR}" matrix: - SHELLCHECK=true From 4b4e71f05c7ad3a8159d5b5ee22a5ec55d7cf2db Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Wed, 23 Nov 2016 21:44:35 +0800 Subject: [PATCH 2/2] [shellcheck] disable "Check exit code directly" warning on line 273, 666 We need to use both the exit state and result form the previous commit, so SC2181 should be disabled here. --- nvm.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvm.sh b/nvm.sh index 544245d25c..dbe039e90d 100755 --- a/nvm.sh +++ b/nvm.sh @@ -269,6 +269,7 @@ nvm_ensure_version_installed() { local NVM_VERSION_DIR if [ "${EXIT_CODE}" != "0" ] || ! nvm_is_version_installed "${LOCAL_VERSION}"; then VERSION="$(nvm_resolve_alias "${PROVIDED_VERSION}")" + # shellcheck disable=SC2181 if [ $? -eq 0 ]; then nvm_err "N/A: version \"${PROVIDED_VERSION} -> ${VERSION}\" is not yet installed." nvm_err "" @@ -663,6 +664,7 @@ nvm_alias() { nvm_ls_current() { local NVM_LS_CURRENT_NODE_PATH NVM_LS_CURRENT_NODE_PATH="$(command which node 2> /dev/null)" + # shellcheck disable=SC2181 if [ $? -ne 0 ]; then nvm_echo 'none' elif nvm_tree_contains_path "$(nvm_version_dir iojs)" "${NVM_LS_CURRENT_NODE_PATH}"; then