aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools/lint-shell.sh
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-04-11 10:01:39 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-04-11 10:01:42 -0400
commitfb17faefb8a314b8644dea3bd063faa1cbd7ae47 (patch)
tree256c8d099fe87184c2e16a0a17d78fc85a7db7c5 /contrib/devtools/lint-shell.sh
parentfefb817009fc544468cc5ca75ed19ab7a7e924df (diff)
parent1499fdc350c0c40985ba20af2ff5a94efa275dbc (diff)
downloadbitcoin-fb17faefb8a314b8644dea3bd063faa1cbd7ae47.tar.xz
Merge #12871: Add shell script linting: Check for shellcheck warnings in shell scripts
1499fdc350 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
Diffstat (limited to 'contrib/devtools/lint-shell.sh')
-rwxr-xr-xcontrib/devtools/lint-shell.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/devtools/lint-shell.sh b/contrib/devtools/lint-shell.sh
new file mode 100755
index 0000000000..5f5fa9a925
--- /dev/null
+++ b/contrib/devtools/lint-shell.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# Copyright (c) 2018 The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#
+# Check for shellcheck warnings in shell scripts.
+
+# Disabled warnings:
+# 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'.
+# SC2006: Use $(..) instead of legacy `..`.
+# SC2016: Expressions don't expand in single quotes, use double quotes for that.
+# SC2028: echo won't expand escape sequences. Consider printf.
+# SC2046: Quote this to prevent word splitting.
+# SC2048: Use "$@" (with quotes) to prevent whitespace problems.
+# 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.
+# SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
+shellcheck -e SC2001,SC2004,SC2005,SC2006,SC2016,SC2028,SC2046,SC2048,SC2066,SC2086,SC2116,SC2148,SC2162,SC2166,SC2181 \
+ $(git ls-files -- "*.sh" | grep -vE 'src/(secp256k1|univalue)/')