Skip to content

Commit fb17fae

Browse files
author
MarcoFalke
committed
Merge #12871: Add shell script linting: Check for shellcheck warnings in shell scripts
1499fdc Add shell script linting: Check for shellcheck warnings in shell scripts (practicalswift) Pull request description: Add shell script linting: Check for `shellcheck` warnings in shell scripts. Tree-SHA512: c7f3f5ed9933415666d2a02f5658cdc62b959ce8112f46b6327ff5f77bb5a66710704c0cde5fd8e719d1fa1fc4f0375a0c115faced166b78e81b75dfb862f08e
2 parents fefb817 + 1499fdc commit fb17fae

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222
- WINEDEBUG=fixme-all
2323
matrix:
2424
# ARM
25-
- HOST=arm-linux-gnueabihf PACKAGES="g++-arm-linux-gnueabihf python3-pip" DEP_OPTS="NO_QT=1" CHECK_DOC=1 GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
25+
- HOST=arm-linux-gnueabihf PACKAGES="g++-arm-linux-gnueabihf python3-pip shellcheck" DEP_OPTS="NO_QT=1" CHECK_DOC=1 GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
2626
# Win32
2727
- HOST=i686-w64-mingw32 DPKG_ADD_ARCH="i386" DEP_OPTS="NO_QT=1" PACKAGES="python3 nsis g++-mingw-w64-i686 wine1.6" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-reduce-exports"
2828
# Win64

contrib/devtools/lint-shell.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2018 The Bitcoin Core developers
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
#
7+
# Check for shellcheck warnings in shell scripts.
8+
9+
# Disabled warnings:
10+
# SC2001: See if you can use ${variable//search/replace} instead.
11+
# SC2004: $/${} is unnecessary on arithmetic variables.
12+
# SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
13+
# SC2006: Use $(..) instead of legacy `..`.
14+
# SC2016: Expressions don't expand in single quotes, use double quotes for that.
15+
# SC2028: echo won't expand escape sequences. Consider printf.
16+
# SC2046: Quote this to prevent word splitting.
17+
# SC2048: Use "$@" (with quotes) to prevent whitespace problems.
18+
# SC2066: Since you double quoted this, it will not word split, and the loop will only run once.
19+
# SC2086: Double quote to prevent globbing and word splitting.
20+
# SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
21+
# SC2148: Tips depend on target shell and yours is unknown. Add a shebang.
22+
# SC2162: read without -r will mangle backslashes.
23+
# SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
24+
# SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
25+
# SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
26+
shellcheck -e SC2001,SC2004,SC2005,SC2006,SC2016,SC2028,SC2046,SC2048,SC2066,SC2086,SC2116,SC2148,SC2162,SC2166,SC2181 \
27+
$(git ls-files -- "*.sh" | grep -vE 'src/(secp256k1|univalue)/')

0 commit comments

Comments
 (0)