1
1
mirror of https://github.com/bitcoin/bitcoin.git synced 2024-05-17 23:56:39 +00:00

Merge #15170: refactor/lint: Add ignored shellcheck suggestions to an array

cbd9091ed5a76bb2e1e57cd0d8db035c15529341 refactor/lint: Add ignored suggestions to an array (Vidar Holen)

Pull request description:

  By adding excluded shellcheck suggestions to an array, you can avoid the current duplication
  between command and comments. This ensures that they never go out of sync, makes it easier to
  add new ones, and improves the readability of related diffs.

Tree-SHA512: 04afced1d27fda940cc5e61d7f9ed04507c8f7f7dfd0031c09898a599c6de93695923a80cb3d515a0f0bf728847592d8680c15ac2e376b48726c03ca744f13a5
This commit is contained in:
Wladimir J. van der Laan 2019-01-16 11:57:20 +01:00
commit 16c4a5373b
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D

View File

@ -22,27 +22,29 @@ if ! command -v shellcheck > /dev/null; then
fi fi
# Disabled warnings: # Disabled warnings:
# SC1087: Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet). disabled=(
# SC1117: Backslash is literal in "\.". Prefer explicit escaping: "\\.". SC1087 # Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).
# SC2001: See if you can use ${variable//search/replace} instead. SC1117 # Backslash is literal in "\.". Prefer explicit escaping: "\\.".
# SC2004: $/${} is unnecessary on arithmetic variables. SC2001 # See if you can use ${variable//search/replace} instead.
# SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'. SC2004 # $/${} is unnecessary on arithmetic variables.
# SC2006: Use $(..) instead of legacy `..`. SC2005 # Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
# SC2016: Expressions don't expand in single quotes, use double quotes for that. SC2006 # Use $(..) instead of legacy `..`.
# SC2028: echo won't expand escape sequences. Consider printf. SC2016 # Expressions don't expand in single quotes, use double quotes for that.
# SC2046: Quote this to prevent word splitting. SC2028 # echo won't expand escape sequences. Consider printf.
# SC2048: Use "$@" (with quotes) to prevent whitespace problems. SC2046 # Quote this to prevent word splitting.
# SC2066: Since you double quoted this, it will not word split, and the loop will only run once. SC2048 # Use "$@" (with quotes) to prevent whitespace problems.
# SC2086: Double quote to prevent globbing and word splitting. SC2066 # Since you double quoted this, it will not word split, and the loop will only run once.
# SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'. SC2086 # Double quote to prevent globbing and word splitting.
# SC2148: Tips depend on target shell and yours is unknown. Add a shebang. SC2116 # Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
# SC2162: read without -r will mangle backslashes. SC2148 # Tips depend on target shell and yours is unknown. Add a shebang.
# SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2162 # read without -r will mangle backslashes.
# SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. SC2166 # Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
# SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. SC2166 # Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
# SC2206: Quote to prevent word splitting, or split robustly with mapfile or read -a. SC2181 # Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
# SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting). SC2206 # Quote to prevent word splitting, or split robustly with mapfile or read -a.
# SC2230: which is non-standard. Use builtin 'command -v' instead. SC2207 # Prefer mapfile or read -a to split command output (or quote to avoid splitting).
# SC2236: Don't force -n instead of ! -z. SC2230 # which is non-standard. Use builtin 'command -v' instead.
shellcheck -e SC1087,SC1117,SC2001,SC2004,SC2005,SC2006,SC2016,SC2028,SC2046,SC2048,SC2066,SC2086,SC2116,SC2148,SC2162,SC2166,SC2181,SC2206,SC2207,SC2230,SC2236 \ SC2236 # Don't force -n instead of ! -z.
)
shellcheck -e "$(IFS=","; echo "${disabled[*]}")" \
$(git ls-files -- "*.sh" | grep -vE 'src/(secp256k1|univalue)/') $(git ls-files -- "*.sh" | grep -vE 'src/(secp256k1|univalue)/')