diff --git a/.travis/lint_04_install.sh b/.travis/lint_04_install.sh index 723e7c56f1d..9a22773e576 100755 --- a/.travis/lint_04_install.sh +++ b/.travis/lint_04_install.sh @@ -9,3 +9,7 @@ export LC_ALL=C travis_retry pip install codespell==1.13.0 travis_retry pip install flake8==3.5.0 travis_retry pip install vulture==0.29 + +SHELLCHECK_VERSION=v0.6.0 +curl -s "https://storage.googleapis.com/shellcheck/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/ +export PATH="/tmp/shellcheck-${SHELLCHECK_VERSION}:${PATH}" diff --git a/test/lint/lint-format-strings.sh b/test/lint/lint-format-strings.sh index 2c443abf6b0..c994ae3f4de 100755 --- a/test/lint/lint-format-strings.sh +++ b/test/lint/lint-format-strings.sh @@ -11,20 +11,20 @@ export LC_ALL=C FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS=( - FatalError,0 - fprintf,1 - LogConnectFailure,1 - LogPrint,1 - LogPrintf,0 - printf,0 - snprintf,2 - sprintf,1 - strprintf,0 - vfprintf,1 - vprintf,1 - vsnprintf,1 - vsprintf,1 - WalletLogPrintf,0 + "FatalError,0" + "fprintf,1" + "LogConnectFailure,1" + "LogPrint,1" + "LogPrintf,0" + "printf,0" + "snprintf,2" + "sprintf,1" + "strprintf,0" + "vfprintf,1" + "vprintf,1" + "vsnprintf,1" + "vsprintf,1" + "WalletLogPrintf,0" ) EXIT_CODE=0 diff --git a/test/lint/lint-shell.sh b/test/lint/lint-shell.sh index cf8a37c3a10..6f5e6546c59 100755 --- a/test/lint/lint-shell.sh +++ b/test/lint/lint-shell.sh @@ -13,7 +13,7 @@ export LC_ALL=C # respectively. So export LC_ALL=C is set as required by lint-shell-locale.sh # but unset here in case of running in Travis. if [ "$TRAVIS" = "true" ]; then - unset LC_ALL + unset LC_ALL fi if ! command -v shellcheck > /dev/null; then @@ -24,7 +24,6 @@ fi # Disabled warnings: disabled=( SC1087 # Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet). - SC1117 # Backslash is literal in "\.". Prefer explicit escaping: "\\.". SC2001 # See if you can use ${variable//search/replace} instead. SC2004 # $/${} is unnecessary on arithmetic variables. SC2005 # Useless echo? Instead of 'echo $(cmd)', just use 'cmd'. @@ -36,10 +35,8 @@ disabled=( SC2066 # Since you double quoted this, it will not word split, and the loop will only run once. SC2086 # Double quote to prevent globbing and word splitting. SC2116 # Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'. - SC2148 # Tips depend on target shell and yours is unknown. Add a shebang. SC2162 # read without -r will mangle backslashes. - SC2166 # Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. - SC2166 # Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. + SC2166 # Prefer [ p ] {&&,||} [ q ] as [ p -{a,o} q ] is not well defined. SC2181 # Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. SC2206 # Quote to prevent word splitting, or split robustly with mapfile or read -a. SC2207 # Prefer mapfile or read -a to split command output (or quote to avoid splitting). diff --git a/test/lint/lint-whitespace.sh b/test/lint/lint-whitespace.sh index beb7ec42f43..f318e19071e 100755 --- a/test/lint/lint-whitespace.sh +++ b/test/lint/lint-whitespace.sh @@ -23,7 +23,7 @@ while getopts "?" opt; do done if [ -z "${TRAVIS_COMMIT_RANGE}" ]; then - if [ "$1" ]; then + if [ -n "$1" ]; then TRAVIS_COMMIT_RANGE="HEAD~$1...HEAD" else TRAVIS_COMMIT_RANGE="HEAD"